DarkRP - AddEntity, run function when bought

AddEntity("whatever", {
		max = 5,
        ent = "great-Entity",
        model = "models/props_lab/partsbin01.mdl",
        price = 50,
		cmd = "/commandlol",
        allowed = {TEAM_MEDIC},
		onBought = function(ply, shipment, ent) ent:CustomFunction(ply) end

ent:CustomFunction never runs.

function CustomFunction(ply)

I’ve also tried putting an ENT: at the front of CustomFunction.
Any ideas?

Why are you trying to do a separate function in it?