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

GUI Isn't dissapearing when I unequip a tool. May I get some help?

Asked by 6 years ago

Script:

script.Parent.Parent.Equipped:connect(function()
    script.Triva.Enabled = true
    script.Triva.Parent = game.Players.LocalPlayer.PlayerGui
end)

script.Parent.Parent.Unequipped:connect(function()
    script.Triva.Enabled = false
    script.Triva.Parent = game.ServerStorage
end)

So basically when I unequip the tool it stays on my screen and doesn't go into ServerStorage.

pls help

1 answer

Log in to vote
1
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

You set its parent to the PlayerGui so it isn't in the script any more.

Also, use Connect (uppercase C), not connect (lowercase C), as connect is deprecated

local trivia = script.Trivia

script.Parent.Parent.Equipped:Connect(function()
    local clone = trivia:Clone()
    clone.Enabled = true
    clone.Parent = game.Players.LocalPlayer.PlayerGui
    script.Parent.Parent.Unequipped:Wait()
    clone:Destroy()
end)
0
@ugosmily Thanks! It works, btw what does "Deprecated" mean xd gamerbeeze1 -3 — 6y
0
It means that it should not be used any more, either because it is broken, obsolete (old) or replaced, because they might stop working at any point, for example, due to an update. http://wiki.roblox.com/index.php?title=Deprecation UgOsMiLy 1074 — 6y
0
Thanks! gamerbeeze1 -3 — 6y
0
You're welcome. UgOsMiLy 1074 — 6y
Ad

Answer this question