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

Help? How do you make a click brick display a GUI? [Solved It Myself]

Asked by
RAYAN1565 691 Moderation Voter
10 years ago

Can someone please fix this script. It doesn't seem to work. This script is placed in the part. The click detector is inside the part along with the script.

01button = script.Parent
02 
03function onClicked (part)
04local player = game.Players:GetPlayerFromCharacter(part.Parent)
05if player ~= nil then
06local GUI = game.Lighting.ScreenGui
07GUI:Clone().Parent = player.PlayerGui
08end
09end
10end
11 
12button.Touched:connect(onTouch)

2 answers

Log in to vote
0
Answered by 10 years ago

I suggest keeping the Gui in StarterGui and setting it to invisible. Then, put a script in the brick that has:


function clicked() game.StarterGui.YourGuiNameHere.Visible = true -- Replace with your screengui's name end

script.parent.ClickDetector.Clicked:connect(clicked)

If it doesn't work ill try it out myself.

0
Nevermind haha. I fixed it on my own.. Thanks for the answer though. RAYAN1565 691 — 10y
0
No problem. Venerex 5 — 10y
Ad
Log in to vote
0
Answered by
RAYAN1565 691 Moderation Voter
10 years ago

Fixed it!

1function Clicked(hay)
2a = game.Lighting.ScreenGui:Clone()
3a.Parent = hay.PlayerGui
4end
5script.Parent.ClickDetector.MouseClick:connect(Clicked)

Answer this question