Need help on re-enabling a Proximity Prompt

prompt.Triggered:Connect(function()
	wait(0.1)
	if script.Parent.Parent.Click.USEABLE.Value == false then
		script.Parent.Parent.Click.USEABLE.Value = true
		prompt.ActionText = "Breached"
		script.Parent.BreachSound:Play()
		wait(1)
		prompt.Enabled = false
	elseif script.Parent.Parent.Click.USEABLE.Value == true then
		prompt.ActionText = "Breached"
		prompt.Enabled = false
	end
end)

if script.Parent.Parent.Click.USEABLE.Value == false then
	prompt.Enabled = true
elseif script.Parent.Parent.Click.USEABLE.Value == true then
	prompt.Enabled = false
end

This is a script in which I have made. I am a terrible scripter. The proximity prompt is meant to only be enabled when the Useable Value is == false. Unfortunately, the script works, ONCE. After that, the proximity prompt disables and doesn’t re-enable again when the Useable property is back to false.

2 Likes

The if / else statement only runs once in the game, what you can do is

script.Parent.Parent.Click.Changed:Connect(function(property) 
-- do your if / else statement here
end)
1 Like

I’m very poor at scripting so I’m not quite sure I understand. I’ve come up with this, which breaks the whole thing together.

prompt.Triggered:Connect(function()
	wait(0.1)
	script.Parent.Parent.Click.Changed:Connect(function(property) 
		if script.Parent.Parent.Click.USEABLE.Value == false then
			script.Parent.Parent.Click.USEABLE.Value = true
			prompt.ActionText = "Breached"
			script.Parent.BreachSound:Play()
			wait(1)
			prompt.Enabled = false
		elseif script.Parent.Parent.Click.USEABLE.Value == true then
			prompt.ActionText = "Unlocked"
			prompt.Enabled = false
		end
	end)
end) 
	wait(0.1)
	if script.Parent.Parent.Click.USEABLE.Value == false then
		script.Parent.Parent.Click.USEABLE.Value = true
		prompt.ActionText = "Breached"
		script.Parent.BreachSound:Play()
		wait(1)
		prompt.Enabled = false
	elseif script.Parent.Parent.Click.USEABLE.Value == true then
		prompt.ActionText = "Breached"
		prompt.Enabled = false
        script.Parent.Parent.Click.USEABLE.Value == false
	end
end)

Try this?

Read what i’ve sent again, I didn’t say change that part of the code, but add the if and else statement that was benith that inside the script.Parent.Parent.Click.USEABLE.Changed:Connect(function(property) end)