How do you open a GUI by equipping a tool?

Hi! I was just wondering how you would make a GUI open from equipping a tool. I’m assuming you would use the equipped event to change the transparency of the GUI, but I’m not really sure how to script it since I am a beginner scripter. Thank you!

12 Likes

What do you mean by “Open gui”?

4 Likes

Sorry I should have explained it clearer :sweat_smile:. I mean kinda like a GUI appears.

3 Likes

So, inside the tool insert a local script.

local player = game.Players.LocalPlayer
local GUI = player.PlayerGui

script.Parent.Equipped:Connect(function() --[[you can add a 
variable for the tool for more easy reference]]
GUI.ScreenGui.Enabled = true --[[ replace screenGui with the name of the screenGui, 
and always make sure the ScreenGui is not enabled in the first place.]]
end)

script.Parent.Unequipped:Connect(function()
GUI.ScreenGui.Enabled = false
end)
18 Likes

Thank you! I’ll try that and let you know how it goes :smile:

3 Likes

did it work?
just wondering :slightly_smiling_face:

3 Likes

(post marked for deletion for privacy reasons)

It should work in a localscript. This topic has aged so we probably won’t expect a reply by the poster.

2 Likes

It didn’t work for me… are you sure its possible to reference PlayerGui from a localscript?

3 Likes

Hello, ive done this previously with Books. I understand what you mean.

You can accomplish this by simply creating a script and the first thing you wanna do is check if the player has equipped the tool, if it hasnt equipped the tool then do nothing… BUT if the tool HAS been equipped by the player then you do the action, which in this case is opening the gui. Hope this helps! :slight_smile:

3 Likes