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.

button = script.Parent

function onClicked (part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player ~= nil then
local GUI = game.Lighting.ScreenGui
GUI:Clone().Parent = player.PlayerGui
end
end
end

button.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!

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

Answer this question