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

Tools with GUIs?

Asked by
Sam4550 42
8 years ago

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

Log in to vote
1
Answered by
Ryzox 220 Moderation Voter
8 years ago

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)
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. Sam4550 42 — 8y
Ad

Answer this question