Proximity Prompt can't change GUI Visible to true after one use, help!

Hi!
I made a script that change a Frame Visible to true when player trigger a ProximityPrompt, but it’s work only one time, this is my script:

local isOpened = false -- Debounce
local Proximity = script.Parent

Proximity.Triggered:Connect(function(player)
	if isOpened == false then
		player.PlayerGui.JarroShop.Hand.Visible = true -- GUI Frame
		isOpened = true
	elseif isOpened == true then
		player.PlayerGui.JarroShop.Hand.Visible = true -- GUI Frame
		isOpened = false
	end
end)

Thanks :sunglasses:

So make it

local isOpened = false -- Debounce
local Proximity = script.Parent

Proximity.Triggered:Connect(function(player)
	if isOpened == false then
		player.PlayerGui.JarroShop.Hand.Visible = true -- GUI Frame
		isOpened = true
	elseif isOpened == true then
		player.PlayerGui.JarroShop.Hand.Visible = false -- GUI Frame
		isOpened = false
	end
end)

Let me know if it didnt work.

but I want to make a script that always Change visible to true, because in this GUI I have a script that close this frame (Close means Change Visible to false)

I think you have to defy the playergui like this:
game:GetService(‘Players’).LocalPlayer:WaitForChild(‘PlayerGui’)

I said this gui shows only first time when player trigger a ProximityPrompt

Make sure the script is localscript
and its place in the startergui

or Try this

local Proximity = script.Parent

Proximity.Triggered:Connect(function(player)
	local Hand = player.PlayerGui:FindFirstChild("JarroShop"):FindFirstChild("Hand")
	if Hand then
		Hand.Visible = not Hand.Visible
	end
end)
1 Like