so i have this tool that (when selected) creates a GUI on your screen that has a list of building tools. when you click a tool it appears in your inventory but when you click another tool that tool is replaced by another one. its an awesome tool but recently (maybe because of a "fix") when you deselect the tool the massive GUI takes over 80% of my screen and once this happens it doesn't go away.
the gui script looks something like this
gui = script.Parent.Tools:clone()
active = false
function onSelected()
if active == false then
active = true
gui.Parent = script.Parent.Parent.Parent.PlayerGui
end
end
function onDeselected()
if active == true then
active = false
gui:remove()
gui = script.Parent.Tools:clone()
end
end
script.Parent.Selected:connect(onSelected)
script.Parent.Deselected:connect(onDeselected)
i need to remove the GUI when the tool is deselected. help? |