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

How to make a GUI appear when a tool is equipped?

Asked by 10 years ago

In the tool, there is a ScreenGui that when then the tool is equipped, I want the Gui to appear.

1script.Parent.Equipped:connect(function(mouse)
2    print("Portable Vending Machine was equipped")
3    if mouse ~= nil then
4        local GUIClone script.Parent.ScreenGui:Clone()
5        GUIClone.Parent = game.Players.LocalPlayers.PlayerGui
6    end
7end)

When I did this, it didn't work. Any suggestions?

1
You're missing an equal sign on line 4 chess123mate 5873 — 10y

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
10 years ago

You actualy missed a couple things. Try this script:

1script.Parent.Equipped:connect(function(mouse)
2    print("Portable Vending Machine was equipped")
3    if mouse ~= nil then
4        local GUIClone=script.Parent.ScreenGui:Clone() --You forgot the equal sign here
5        GUIClone.Parent = game.Players.LocalPlayer.PlayerGui --It has to be "LocalPlayer", not "LocalPlayers". Drop the 's'
6    end
7end)

I fixed the 2 things I think you missed. Anyways, this should work now. If not, or if you have any question, please leave a commet below. Hope I helped :P

0
This didn't work... connieoop 10 — 10y
Ad

Answer this question