local player = game:GetService("Players").LocalPlayer local oGUI = script:FindFirstChild("ScreenGui") script.Parent.MouseClick:Connect(function() local GUI = oGUI:Clone() GUI.Parent = player.PlayerGui end)
Im trying to make a button , where if you click it , a GUI pops up , but when i tested it , nothing happens and there are no errors , can anybody tell me what's happening ? (Local Script)
Your cloning the entire screen gui you need to clone just a single gui for a example try doing this
local player = game:GetService("Players").LocalPlayer local oGuI = game:GetService("StarterGui").Guiyouwannaenable script.Parent.MouseClick:Connect(function() local GUI = oGUI:Clone() GUI.Enabled = true GUI.Frame.Visible = true GUI.Parent = player.PlayerGui end)
Do not do this though
local player = game:GetService("Players").LocalPlayer local oGuI = game:GetService("ScreenGui").Guiyouwannaenable script.Parent.MouseClick:Connect(function() oGUI.Enabled = true end)
the thing with that is you will have to reset for it to pop up and everybody will see it unless its a local script
The issue here is that you've got your local script inside workspace. Local Scripts don't run inside workspace so you'll need to parent it somewhere else. Local scripts will only run if it's a descendant of the Player's Backpack, Character Model, PlayerGui, PlayerScripts or the ReplicatedFirst service as you can see here.
I would recommend you to parent your local script inside StarterGui and simply just change your variables.
local player = game:GetService("Players").LocalPlayer workspace.Part.ClickDetector.MouseClick:Connect(function() -- Make sure to change this to where your ClickDetector is located inside your part. local oGUI = workspace.Part:FindFirstChild("ScreenGui") -- Make sure to also change this to where your GUI is located inside your part. if oGUI then local GUI = oGUI:Clone() GUI.Parent = player.PlayerGui end end)