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

checking if something exists in localplayer?

I want to check if something exists within the local player, if it doesn't, I want something to happen. How do I do this?

2 answers

✓ Accepted answer

The FindFirstChild method will return true if it finds the specified object. In your LocalScript, put something like this:

if game.Players.LocalPlayer:FindFirstChild("NameOfObjectHere") then
    --do stuff
end

Hope this helps!

Also note that LocalPlayer only exists to the client, and referencing it needs to be done through a LocalScript (as I'm sure you are aware).

if game.Players.LocalPlayer:FindFirstChild("NameHere") then
	--Script
	else
	print("Error can't find object in localplayer")
end

This needs to be a local script

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