rukucii
(rukucii)
October 19, 2023, 6:03pm
#1
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
PIayanad
(Destroyanad)
October 19, 2023, 6:06pm
#2
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
dswqsa895
(Dsw official)
October 19, 2023, 6:06pm
#3
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)
´´´
dswqsa895
(Dsw official)
October 19, 2023, 6:09pm
#4
Also make sure all of the GUI content is inside a ScreenGui object.
1 Like
system
(system)
Closed
November 2, 2023, 6:10pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.