Simple functions returning nil

I currently have this code:



local _R = debug.getregistry().Player;
AddRandomPhrase(function(ply)
	ply:ChatPrint("Wow, you got me");
end)

function RandomFunc()
	for k, v in pairs(RandomPhrases) do
		return v;
	end
	return false;
end

function ENT:StartTouch(ply)
	if (ply:IsPlayer()) then
		self.Entity:Remove()
		local GotRandFunc = RandomFunc()
		GotRandFunc:func(ply);
	end
end


Everytime I touch the entity the server console prints out an error similar to this:

Error:


attempt to call method 'ChatPrint' (a nil value) 

No matter what function I try to run on the client, it always returns a nil value.

how would i fix this?

Try replacing

[lua]GotRandFunc:func(ply)[/lua]

by

[lua]GotRandFunc.func(ply)[/lua]

wow, i feel stupid now.

Thanks for the help!