How do I make when I equip a tool a gui shows

How do I make when I equip a tool a GUI shows

2 Likes
local tool = script.Parent
local player = game.Players.LocalPlayer

local gui = player:WaitForChild("PlayerGui").(continue with the location of your gui)

tool.Equipped:Connect(function()
   gui.Enabled = true
end)

tool.Unequipped:Connect(function()
   gui.Enabled = false
end)

Needs to be a localscript inside of the tool

1 Like

put this inside the tool??? :thinking:

Put it in a localscript inside of your tool yea, I forgot ot mention the 2nd bit

ok thank you :grinning: :smiley: :smile:

Anytime! If you have anymore issues don’t be afraid to make another post!

in the output it says

Players.JadtrugamingYT1.Backpack.Tool.LocalScript:4: Expected identifier, got '(' 

that is the script

local tool = script.Parent
local player = game.Players.LocalPlayer

local gui = player:WaitForChild("PlayerGui").("wdw")

tool.Equipped:Connect(function()
   gui.Enabled = true
end)

tool.Unequipped:Connect(function()
   gui.Enabled = false
end)

Remove the brackets from “wdw”

local gui = player:WaitForChild("PlayerGui")."wdw"

ok thank you i will try this now

it still does not work :frowning_face: :slightly_frowning_face: :thinking:

Oh wait I see, remove the quotation marks too

local gui = player:WaitForChild("PlayerGui").wdw

now it says this

 wdw is not a valid member of PlayerGui "Players.JadtrugamingYT1.PlayerGui"

Then you’re referencing the wrong ScreenGui, you need to get the location of the right gui. Example, if your ScreenGui is a direct parent of StarterGui and it’s called “GUI”, just do

local gui = player:WaitForChild("PlayerGui").GUI

ok i will try that :smile: :grinning:

Still doesnt work :thinking: :face_with_raised_eyebrow:

Ok what is your code right now/Any errors?

GUI is not a valid member of PlayerGui “Players.JadtrugamingYT1.PlayerGui”

You have to replace “GUI” with the actual name of your ScreenGui

I’m not saying to copy the code exactly, replace GUI with the name of your ScreenGui

If it’s called stats, change GUI to stats, if it’s called Power, change GUI to Power

The code I sent is the simplest way to do it, you’re just not referencing the ScreenGui correctly

i made this will this work

script.Parent.Equipped:Connect(function()
 local playerName = script.Parent.Parent.Name
 local player = game.Players:FindFirstChild(playerName)
 local gui = script.Parent.ScreenGui
 gui.Parent = player.PlayerGui
end)

script.Parent.Unequipped:Connect(function()
 local player = script.Parent.Parent.Parent
 local gui = player.PlayerGui.ScreenGui
 gui.Parent = script.Parent
end)
5 Likes