Proximityprompt doesn't run a certain part of the script after first time

So yeah the proximityprompt works first time and prints hey and second time it prints hey but won’t enable the gui
Here is my script:

script.Parent.ProximityPrompt.Triggered:Connect(function(Player)
	print("Hey")
	if Player.PlayerGui.ScreenGui.Enabled == false then
		Player.PlayerGui.ScreenGui.Enabled = true
		end
end)

I’m almost 100% sure of why is this happening. You’re setting the ScreenGui.Enabled to false with a LocalScript to close it right? If that’s the case; when you change this locally the server thinks it’s still enabled, so when you run it again, even if it’s set to false, it will not perform any action because of this.

To stop this from happening you should fire a RemoteEvent to the client and enable the ScreenGui from there.

nope it’s server script that’s why i am using player as a refrence to the gui. i also know about filtering enabled

The code you provided indeed is a server-sided script.

I’m talking about the script you use to close the ScreenGui, because in OP you specified you re-open it again, deducting you have something that closes it.

OH I FORGOT ABOUT THAT thank you so much

btw u don’t need a remote event u should just do script.Parent.Parent.Parent.Visible = false in serverscript