Give me a minute, I need to open everything back up again :// Studio crashed for some reason
Yeah, the frame is not visible by default, and I have Debounce set to false. Here is the script:
local Debounce = false --Our debounce value
local Prompt = game.Workspace.JapaneseShrine.Model1.Model2.Model3.Model4.Model5.Model6.Model7.Model8.OpenGUIPart.ProximityPrompt
local GUI = script.Parent
Prompt.Triggered:Connect(function(Player) --Prompt triggered
if Debounce then --Check if debounce is true
GUI.Visible = false --Close UI
else
GUI.Visible = true --Open UI
end
Debounce = not Debounce --Flip the value (If true goes false, if false goes true)
end)
Sorry I’m bad at formatting on DevForum, hopefully you can understand this. Also, the model I made is very, very unorganized, that’s why there’s so many "Model_"s.
Alright, I’m gonna get some sleep, I’ll try to fix this in the morning.
Alright, I think I’ve figured it out.
I have a TextButton inside the frame so that when you click it, it closes. The problem is, when I click that button, the Debounce doesn’t update. That makes it so that when I activate the ProximityPrompt again, it runs the code to make the Frame not visible. I believe all I have to do is delete the script under the TextButton and put it into the LocalScript in the ScreenGui, then sync the button clicking with the Debounce.
Alright, I’ve gotten it working. Here’s the final code:
local Debounce = false --Our debounce value
local Prompt = game.Workspace.JapaneseShrine.Model1.Model2.Model3.Model4.Model5.Model6.Model7.Model8.OpenGUIPart.ProximityPrompt
local GUI = script.Parent
script.Parent.TextButton.MouseButton1Down:Connect(function()
script.Parent.Visible = false
Debounce = not Debounce
end)
Prompt.Triggered:Connect(function(Player) --Prompt triggered
if Debounce then --Check if debounce is true
GUI.Visible = false --Close UI
else
GUI.Visible = true --Open UI
end
Debounce = not Debounce --Flip the value (If true goes false, if false goes true)
end)