Gui not opening after closing it

I’m trying to make a gui open when I activate a proximity prompt and close when I press an X, but after closing it, it stops opening after that.

Script in proximity prompt:

local Prompt = script.Parent

Prompt.Triggered:Connect(function(Player)
	Player.PlayerGui.Menu.Frame.Visible = true
	print("open")
end)

Local script in StarterGui frame:

local Frame = script.Parent
local Close = Frame.Background.Close

Close.MouseButton1Down:Connect(function()
	Frame.Visible = false
	print("close")
end)

image

image

1 Like

turn the proximity prompt script into local script and see what happens

1 Like

That didn’t fix it, and I think that local scripts don’t work in the workspace.

1 Like

You can use remote events, when the proximity prompt is triggered use :FireClient(plr) (you can get the player from the triggered event in proximity prompt) and in the gui local script when the remove event is triggered make it not visible

2 Likes

oh, then i suppose “Animate” which is a localscript, located under workspace will not work?

my apologies for going offtopic. have you playtested and checked the explorer to see if Visible property is enabled?

The server will always think that the Frame is visible, so It won’t change it, even if you turn it off by a LocalScript. You have to turn the Visibility off by a script aswell.

1 Like

This gave me the idea to change the run context to client which fixed it, but I’m still not sure why it only works once on legacy.

1 Like

client and server is different. you are changing property on server while also changing client which causes this issue

1 Like

Thanks, I should’ve thought of that.

1 Like

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