Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Local Script in tools not working after refresh. Any answers?

Asked by
ghxstlvty 133
4 years ago
Edited 4 years ago
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 answer

Log in to vote
1
Answered by
srimmbow 241 Moderation Voter
4 years ago

Instead of accessing the gui from the LocalPlayer, try to access it like this:

local Tool = script.Parent
local Gui= game.StarterGui:WaitForChild("MENU"):WaitForChild("Home")

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

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

Answer this question