Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

2 comments

0

Nevermind haha. I fixed it on my own.. Thanks for the answer though.

0

No problem.

Fixed it!

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

This discussion is preserved as it was. New answers, comments, and votes are closed.