What do you want to achieve? I want to have a GUI pop up when you click a part.
What is the issue? I got it to work but it only works once. For example, if I click the part once it works. I close out of the gui and click it a second time but it doesn’t work the second time.
What solutions have you tried so far? I have tried looking on the dev forum, and multiple videos but no luck.
Here is some details. I put a click detector in a part, and a script in the click detector. Here is the code I used.
player:WaitForChild(“PlayerGui”).DoorGUI.DoorSystem.Visible = true
Like I said above, it works only once, but when you close out of the gui and try it again, it doesn’t work. Thanks for reading, btw!
April 28, 2020, 7:52pm
p:WaitForChild(“PlayerGui”).DoorGUI.DoorSystem.Visible = true
script.Parent.Parent.Visible = false
April 28, 2020, 7:52pm
Did you check if your exit button makes it visible or deletes the GUI
When you click the x button it makes visible = false
April 28, 2020, 8:24pm
dont waitforchild just do if p.PlayerGui then <code here> end
April 28, 2020, 8:25pm
if that doesnt work do if p:FindFirstChild("PlayerGui") then <codehere> end
@romeanyguy10 Welcome to the forums!
The script you are using can we improved, this is a local script inside the x button:
local Part = #The part with the ClickDetector
local ClickDetector = Part.ClickDetector
local GUI = #the GUI to become visible and invisible
local XButton = script.Parent
GUI.Visible = true
GUI.Visible = false
@iSyriux You should utilize waitforchild because there is no guarantee that the playergui has been loaded yet. Please be sure before tou assume things.
It didn’t work when I tried to test. I tried to write “ClickDetector.Clicked” but when I write “Clicked,” it isn’t identifying anything.
Oops, that was a typo, it’s
It didn’t work. Again when I typed MouseClick it didn’t identify anything. There were no red lines which was good but when I typed MouseClick it didn’t identify anything. Thanks for helping btw!
April 28, 2020, 9:03pm
Did you fill in the missing variables?
Yep I filled them in correctly.
April 28, 2020, 9:05pm
Can you paste your GUI variable for me?
frame = game.StarterGUI.DoorGUI.DoorSystem
Okay! Let me try it real quick…
Just to make things clear. A local script inside of the x button?
April 28, 2020, 9:10pm
I have the same problem, I only got a GUI to pop up once but I could not open it again after closing it.
I hope you find the answear to fix it though!
April 28, 2020, 9:11pm
Correct. Also, replace the frame variable with this:
frame = game.Players.LocalPlayer:WaitForChild(“PlayerGui”).DoorGUI.DoorSystem
Didn’t work. When I was typing frame.Visible, it would not even identify frame. Also, when I was writing MouseClick, it didn’t identify that either. Lastly in the output I saw this “- Infinite yield possible on ‘Players.romeanyguy10:WaitForChild(“PlayerGUI”)’” - Could that mean something?
Is the code in a server script or local script?
Server scripts look like the normal paper, local scripts have the little player icon on them