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

Tool open UI script not working at all. Anyone know how to solve this?

local Tool = script.Parent
local Gui= game.Players.LocalPlayer.PlayerGui.MENU.Home

Tool.Equipped:connect(function()
Gui.Visible = true
end)

Tool.Unequipped:connect(function()
Gui.Visible = false
end)

Dev Console Output: https://prnt.sc/saicp1

3 answers

✓ Accepted answer

The main issue is that your LocalScript loads before your GUI, which is breaking the script LocalScript. An :WaitForChild() will fix the issue. The second issue is that :connect is deprecated and you should use :Connect instead.

I assume you don't have a Handle for you tool. Go to your tool's properties and uncheck "RequiresHandle". If it is checked and your tool doesn't have a handle, the Equipped and Unequipped events won't fire.

local Tool = script.Parent
Tool.RequiresHandle = false
local Gui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("MENU").Home

Tool.Equipped:Connect(function()
	Gui.Visible = true
end)

Tool.Unequipped:Connect(function()
	Gui.Visible = false
end)

2 comments

0

Thanks, that was stupid of me.

0

Don't blame yourself. Everyone starts somewhere. Glad I could help.

probably an error of the gui not loading

local Tool = script.Parent
local Gui= game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("MENU"):WaitForChild("Home")

Tool.Equipped:connect(function()
Gui.Visible = true
end)

Tool.Unequipped:connect(function()
Gui.Visible = false
end)

1 comment

0

Still not working, but there's no output in the dev console anymore.

Try to add a remote event. Tell me later if it worked!

2 comments

0

Local script, should it be a server script?

0

Doesn't work.

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