ProximityPrompt script running only once

Hello, I’ve made a script that makes a UI Visible when triggered but after i set the UI to invisible and then try to trigger the ProximityPrompt it doesn’t work.

local ts = game:GetService("TweenService")
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	local StarterPackUI = player.PlayerGui.StarterPackUI.StarterPackUI
	StarterPackUI.Visible = true
end)

(the script isn’t a local script btw)

From my understanding its invisible so it wont reverse it if you set it invisible twice maybe you can make it so you open it with proximity prompt, then make it invisible with a textbutton.

yes thats what i did, but after reopening it it just doesnt work

1 Like
script.Parent.ProximityPrompt.Triggered:Connect(function(player)

local StarterPackUI = player.PlayerGui.StarterPackUI.StarterPackUI

StarterPackUI.Visible = true

end)

--Make a textbutton with a new local script parented to it and write this in it customize exit button to your liking

script.Parent.MouseButton1Click:Connect(function(player)

local StarterPackUI = player.PlayerGui.StarterPackUI.StarterPackUI

StarterPackUI.Visibile = false

end)

If you set the UI to be visible on the server but then make it invisible again on the client, the server will still think it is visible the next time the prompt is triggered and thus won’t do anything. Your prompt trigger code should be ran on the client.

I had an issue like this for the win UI in my game. I fixed using something similar to this:

local ts = game:GetService("TweenService")
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	local StarterPackUI = player.PlayerGui.StarterPackUI.StarterPackUI
	StarterPackUI.Visible = false
	StarterPackUI.Visible = true
end)

--[[ Last synced 5/6/2023																RoSync Loader jk xD]]