✓ Accepted answer
You are probably getting error that you are trying to compare number and Instance, if [Temp] is an "IntValue", you need to get it's value by indexing it with [.Value]:
if workspace.Temp.Value >= 6500 then
script.Parent.Meltdown.Disabled = false
end
This however as you know would only check it once, you could use the while loop as you did however it's not efficient, GetPropertyChangedSignal will return a signal which will fire when property of the Instance changes.
local Meltdown = script.Parent.Meltdown
local Temp = workspace.Temp
local function OnValueChangedAsync()
if Temp.Value >= 6500 then
if Meltdown.Disabled then
Meltdown.Disabled = false
end
end
end
Temp:GetPropertyChangedSignal("Value"):Connect(OnValueChangedAsync)
I also added a check that will check if [Meltdown] is not disabled, this is not neccessary but prevents changing variable's value to same value, that would not cause an issue but yes.
4 comments
It gives in the output: "attempt to call a nil value" in red.
It must be coming from other scripts you have, not from this one.
is "Disabled" the script property or a BoolValue?
Oh yeah, thank you :) it worked! Thank you very much!