I'm trying to make a GUI open when a tool is equipped but i can't seem to do it.
This is my script so far.
gui = script.ScreenGui.Begin Tool = script.Parent Tool.Equipped:connect(function(mouse) gui.Visible = true end)
I've tried looking for scripts on google and moving the gui in multiple places to no avail.
I'm probably doing something that's really simple wrong, but i can't figure this out.
Guis only function in the PlayerGui
. I'm going to use the Clone()
function to make a copy of the GUI and move it to the player's GUI. You should also be using a Local Script
.
Example,
-- Local Script in the tool in StarterPack local plr = game.Players.LocalPlayer local plrGui = plr:WaitForChild("PlayerGui") local gui = script:WaitForChild("ScreenGui") local Tool = script.Parent Tool.Equipped:connect(function(mouse) local guiClone = gui:Clone() guiClone.Visible = true guiClone.Parent = plrGui end)
Good Luck
Maybe because for gui
you put script.ScreenGui
when for tool you did script.Parent
. Obviously this script is located inside a tool so try script.Parent.Parent.ScreenGui.Begin
?