(Solved) [Can turn off tourch's fire but can't trun it back on

Hello,

So i made a tourch model, added a ProximityPrompt to one of it’s part and i wanna make it so if you trigger the prompt then a tourch’s fire turns on or off depending if it’s turned on or turned off at the moment.

So when I trigger the prompt i can turn the fire off but can’t turn it back on.

This is the structure of the tourch model:
Képernyőkép 2023-04-22 140858

Holder.ProximityPrompt.Light script:

local prompt = script.Parent
local model = script.Parent.Parent.Parent
local coal = model.Coal
local fire = coal.Fire
local smoke = coal.Smoke
local status = fire.Status.Value

prompt.Triggered:Connect(function()
	if status == "true" then
		fire.Enabled = false
		smoke.Enabled = true
		smoke.Enabled = false
		prompt.ObjectText = "Light"
		prompt.TriggerEnded:Wait()
	else
		fire.Enabled = true
		prompt.ObjectText = "Turn off"
		prompt.TriggerEnded:Wait()
	end
end)

I get no errors in the output, but the tourch’s fire doesn’t turn back on.

I guess this is causing it. status is storing the value and not the instance. so when the value of instance changes, it won’t change the variable stored in status. Instead try this script

local prompt = script.Parent
local model = script.Parent.Parent.Parent
local coal = model.Coal
local fire = coal.Fire
local smoke = coal.Smoke
local status = fire.Status

prompt.Triggered:Connect(function()
	if status.Value then
		fire.Enabled = false
		smoke.Enabled = true
		smoke.Enabled = false
		prompt.ObjectText = "Light"
		prompt.TriggerEnded:Wait()
	else
		fire.Enabled = true
		prompt.ObjectText = "Turn off"
		prompt.TriggerEnded:Wait()
	end
end)

Changed it and it still doesn’t work. Still no errors in the output.

Are you even ever changing the status value? Also, i dont see a point having a value here as you can just do this.

local on = true

if on then
on = false
— blah blah code
else
on = true
— blah blah turning on code aaaaaa
end