Open GUI when clicking a button

Hello,

I have a Part in my workspace, and i also have a GUI.
What i want is when i click the part, it opens the GUI.

I have tried putting the script inside the GUI, but the part spawns with a different group everytime so i can’t do that.

And it also doesn’t work for me inside the part, but i don’t understand how to do that.

Is there any way to open a GUI, when clicking a part. But the script is inside the part?

1 Like

Add a click detector onto the part. Add a script as the child of the click detector, and in the script, you can check for script.Parent.MouseClick. Connect that to a function, and pass “player”. Using the player variable, you can grab the playerGUI and enable the GUI

1 Like

Add a ClickDetector to your part, then add the gui you want it to show inside the part too. Then insert a script with this

´´´lua
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local guiClone = script.Parent.YourGUINameHere:Clone()
guiClone.Parent = player.PlayerGui
end)
´´´

Also make sure all of the GUI content is inside a ScreenGui object.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.