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

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

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

✓ Accepted answer

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)

4 comments

0

@ugosmily Thanks! It works, btw what does "Deprecated" mean xd

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

0

Thanks!

0

You're welcome.

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