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

Tools with GUIs?

How do I make a tool which clones the GUI when it's equipped and when it's unequipped, it destroys? I have no idea...

1 answer

✓ Accepted answer

http://wiki.roblox.com/index.php?title=Tool

Please check the wiki before coming here.

local tool = script.Parent -- assuming script is in tool
local gui = game.ReplicatedStorage.Gui -- example gui

tool.Equipped:connect(function(mouse)
	local guiclone = gui:Clone()
	guiclone.Parent = player.PlayerGui-- assuming you already have "player" defined
end)

tool.Unequipped:connect(function()
	if player.PlayerGui:findFirstChild("Gui") then
		player.PlayerGui:findFirstChild("Gui"):Destroy() -- removes "Gui"
	end
end)

1 comment

0

Sorry, I was looking in the wrong part of the wiki. I was looking at .Equipped and .Unequipped and I couldn't see where I was going wrong, thanks.

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