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)
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.
Fixed it!
function Clicked(hay) a = game.Lighting.ScreenGui:Clone() a.Parent = hay.PlayerGui end script.Parent.ClickDetector.MouseClick:connect(Clicked)