I have absolutely no clue how to do this but I really need to know how to do it
How do I make a gui appear when a tool is equipped ?
2 answers
use the .Equipped and Unequipped events of a tool. Then, make the gui visible
EXMAPLE
Tool = game.StarterGear.Tool
Gui= game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame
Tool.Equipped:connect(function()
Gui.Visible = true
end)
-- Allows GUI to go away
Tool.Unequipped:connect(function()
Gui.Visible = false
end)
For more information, Use the rblox wiki and go to this link http://wiki.roblox.com/index.php?title=API:Class/Tool
And look at the events section
So I have just an example, I actually use this for my Mobile Controls Basketball.
local plr = game.Players.LocalPlayer --This is a Local Script
local playerGui = plr:WaitForChild("PlayerGui") --Better like this.
local controlGuiClass = script.Parent.ControlsGUI
local tool=script.Parent
--What I did was put the GUI inside the Tool.
tool.Equipped:connect(function()
local CGClone = controlGuiClass:Clone()
CGClone.Parent = playerGui --Transfer the Cloned GUI into the Player's GUI.
CGClone.TextButton.Visible = true --I have my Visibility turned off, so I manually turn it on in this script.
end)
tool.Unequipped:Connect(function()
if playerGui:FindFirstChild("ControlsGUI") then -- B/c it'll check the original variable, which you'll have to have the script
playerGui.ControlsGUI:Destroy()
end
end)
--Whenever you Unequip that tool, the GUI would be destroyed, meaning if you didn't have the Unequipped function, you would have a GUI still on your screen lol.
Also you could put it inside the Replicated Storage, but this method up here is more efficient, at least that's what I think.
Hopefully this helps, LukeGabrieI
4 comments
Which parts would i change to make it fit my game. Would I have to change all the control things or what ?
Basically lol.
Luke, I know this is an old post, but I need your help! The equipped function part works, but not the unequipped function, I've tried everything I dont know that to do, help plz
Queen, I know this is an old reply but you can try turning off required handle
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
would this be in a script or a local script ? sorry if im being nooby lol
Local script, sorry for not elaborating on that
im being very nooby sorry if im annoying but where do i put this local script ?
anywhere, i recommend starter player scripts. Workspace also works. DO NOT put in storages or the serverscript service