Frame won't open after it was opened once

I want the player to be able to open a store frame using ProximityPrompt. The frame and GUI is located inside StarterGUI and I’m making it so that it opens locally for the player only.

The issue is that after it is opened and closed ONCE, it breaks and it doesn’t open anymore, even though it prints out that it has-

Code

Script inside ProximityPrompt inside part

script.Parent.Triggered:Connect(function(Player)
	Player.PlayerGui.Store.ScrollingFrame.Visible = true
	print(Player.DisplayName.." opened store menu!")
end)

Code inside close button of frame

local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	Player.PlayerGui.Store.ScrollingFrame.Visible = false
end)

Is there an error in my script because I have never had this problem-?

It’s because the button is most likely being closed from the client but being opened from the server, the server still sees it as open, I’d change your proximityPrompt script to be a localscript in StarterPlayerScripts with a small check to ensure it only opens hte gui for who triggered the prompt, such as checking if the player who triggered the prompt is the same as the local player

It works perfectly! Thanks a lot!

1 Like