Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this function going off when it's not being called?

function FindPlr(a, plr)
	local a = false
	for i,v in pairs(game.Players:GetPlayers()) do
		if string.find(string.lower(string.sub(v.Name,1,string.len(plr))),string.lower(plr),1,false) and plr ~= "" then
			a = v.Name
		end
		end
	return a
end
Functions.FindPlr.OnServerInvoke = FindPlr()

It's not being invoked though..........

1 answer

✓ Accepted answer

If you put parenthesis () after a function, it will always run. To fix it just remove it, as you want it to store the function, not the value it returns.

Functions.FindPlr.OnServerInvoke = FindPlr

2 comments

0

Thanks... I'm stupid haha

0

No problem. We all make silly mistakes every now and then ;)

This discussion is preserved as it was. New answers, comments, and votes are closed.