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

How do I get the player, from the Equipped Event? Help me.

Hello, I am making a menu tool. So I am using the Equipped Event.

So when you equip the tool a gui will appear at the player's screen. I am using a Script and I made a GUI.

What I wan't to know how I will get the player. You can't use game.Players.LocalPlayer in scripts. How do I get the player?

Script:

tool = script.Parent
menu = script.Parent.Menu

tool.Equipped:connect(function(player)
	menu:Clone().Parent = player:WaitForChild("PlayerGui")
end)

tool.Unequipped:connect(function(player)
	player:WaitForChild("PlayerGui"):WaitForChild("Menu"):Destroy()
end)

Please help me.

1 answer

✓ Accepted answer

If you are using a tool to manipulate the interface, you should be using a LocalScript.

1 comment

0

Thanks. ;)

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