How would I make it so when you click a Proximity Prompt Again, everything will go back to its original state

I’m currently making a Faucet system, but the thing is I am unsure on how to make it so that when you trigger it a second time everything goes back to it’s original state. I’ve tried searching through the Proximity Prompt Section, in the API but found nothing.

local prompt = script.Parent

debounce = true

prompt.Triggered:connect(function(Player)
	prompt.ActionText = "Turn Off"
	game.Workspace.Water.Transparency = 0.65
	game.Workspace.Watur.ParticleEmitter.Enabled = true
	script.Parent.Parent.WaterRunningSound.Playing = true
	
	
end)

Save a value titled enabled, and toggle it whenever you get the triggered event.

You can check this value and set the parts/effects accordingly.

You can use the not statement for the boolean like this

prompt.Triggered:connect(function(Player)
	game.Workspace.Watur.ParticleEmitter.Enabled = not game.Workspace.Watur.ParticleEmitter.Enabled
	script.Parent.Parent.WaterRunningSound.Playing = not script.Parent.Parent.WaterRunningSound.Playing
 
 
	
	
end)

For the other part you can simply use a bool like the debounce then if its false it sets string to “Turn Off” and set debounce to true else if the debounce is true it sets string to “Turn On” etc.

1 Like