Fossit ProximityPrompt system not working

Hi!
I made this ProxPront interaction script. It works for the first time, then turns off again, then breaks.
What’s wrong?

while wait() do
	wait()
	workspace.City.Cafe.Cafe.Sink1.FossitPart.ParticleEmitter.Enabled = false
	workspace.City.Cafe.Cafe.Sink1.ProxPart.ProximityPrompt.Triggered:Connect(function(player)
		
	--- turn on
		if  workspace.City.Cafe.Cafe.Sink1.ProxPart.ProximityPrompt.ActionText == "Turn on Fossit" then
			wait()
	print("Someone has turned on the fossit.")
		workspace.City.Cafe.Cafe.Sink1.FossitPart.ParticleEmitter.Enabled = true
			workspace.City.Cafe.Cafe.Sink1.ProxPart.ProximityPrompt.ActionText = "Turn Off Fossit"
			wait()
		---turn off
		elseif  workspace.City.Cafe.Cafe.Sink1.ProxPart.ProximityPrompt.ActionText == "Turn Off Fossit" then
			wait()
			print("Someone has turned off the fossit.")
			workspace.City.Cafe.Cafe.Sink1.FossitPart.ParticleEmitter.Enabled = false
			workspace.City.Cafe.Cafe.Sink1.ProxPart.ProximityPrompt.ActionText = "Turn On Fossit"
			wait()
		end
	
	end)
	workspace.City.Cafe.Cafe.Sink2.FossitPart.ParticleEmitter.Enabled = false
	workspace.City.Cafe.Cafe.Sink2.ProxPart.ProximityPrompt.Triggered:Connect(function(player)
		--- turn on
		if  workspace.City.Cafe.Cafe.Sink2.ProxPart.ProximityPrompt.ActionText == "Turn on Fossit" then
			wait()
			print("Someone has turned on the fossit.")
			workspace.City.Cafe.Cafe.Sink2.FossitPart.ParticleEmitter.Enabled = true
			workspace.City.Cafe.Cafe.Sink2.ProxPart.ProximityPrompt.ActionText = "Turn Off Fossit"
			wait()
			---turn off
		elseif  workspace.City.Cafe.Cafe.Sink2.ProxPart.ProximityPrompt.ActionText == "Turn Off Fossit" then
			wait()
			print("Someone has turned off the fossit.")
			workspace.City.Cafe.Cafe.Sink2.FossitPart.ParticleEmitter.Enabled = false
			workspace.City.Cafe.Cafe.Sink2.ProxPart.ProximityPrompt.ActionText = "Turn On Fossit"
			wait()
		end

	end)
	end

uhh idk why you have a while loop there but maybe thats the reason its causing the issue.

you are continously looping and adding proximityprompts triggers. so when you actually trigger the prompt, its gonna set off all those multiple triggers at the exact same time, causing some sort of race condition. honestly getting rid of the while loop would fix most of your issues since only one trigger is needed to set it up (per sink).
im assuming other parts are correct.

1 Like

if i didnt have the while true loop, it wouldn’t respond again. right?>

1 Like

no no once you set up the trigger once it will work always (unless you decided to disconnect or the script that has the trigger function was destroyed or the object was destroyed).

2 Likes

image
Once I TURNED IT ON THEN OFF, IT BROKE.

you have codes that literally says

...ActionText == "Turn on Fossit" then

YET you set the action text as

...ActionText = "Turn On Fossit"

see the issue? on VS On
coding is case sensitive.

2 Likes

I’m stupid. Lemme try that… d