ProximityPrompt GUI won't open more than once

Ok so i am doing to no a npc shop where i can buy items and food and this work perfectly
The thing is the gui won’t open more than once

Error:

Open GUI Script:

local Part = script.Parent
local ClickDetector = Part:WaitForChild("ProximityPrompt")
local fr1 = game.StarterGui.FoodGUI.Frame
ClickDetector.Triggered:connect(function(Player)

	print("Test")
Player.PlayerGui.FoodGUI.Frame.Visible = true
	
end)

Close GUI Script:

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function(layer)
	--	mpService:PromptProductPurchase(player,1183070939)
	Player.PlayerGui.FoodGUI.Frame.Visible = false


end)

How can i fix this please?

1 Like

It might be because the server already thinks that the GUI is visible, since you only turned its visibility off in the client. You could try this, but I haven’t tested:

Open GUI Script:

local Part = script.Parent
local ClickDetector = Part:WaitForChild("ProximityPrompt")
local fr1 = game.StarterGui.FoodGUI.Frame
ClickDetector.Triggered:connect(function(Player)

	print("Test")
Player.PlayerGui.FoodGUI.Frame.Visible = false
Player.PlayerGui.FoodGUI.Frame.Visible = true
	
end)
2 Likes

Also, along with @Rietria’s post, do a capital c in connect.

1 Like

Its working now ty for your help!!!