Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you detect if a value was changed inside of a NumberValue value?

Asked by 9 years ago
maxfuel = 100
function Overflow()
if script.Parent.MaxFuel.Value > maxfuel then
    script.Parent.MaxFuel.Value = 100
end
end

script.Parent.MaxFuel.Value.Changed:connect(Overflow)

It's to check if the car's fuel tank has overflowed, and if it does, it'd reset it to 100. Although, it's not working for me. Any tips?

1 answer

Log in to vote
0
Answered by
Kurieita 125
9 years ago

Sorry I don't completely understand the question, but correct me if I am wrong

Wouldn't it be

maxfuel = 100
function Overflow()
if script.Parent.MaxFuel.Value > maxfuel then
    script.Parent.MaxFuel.Value = 100
end
end

script.Parent.MaxFuel.Changed:connect(Overflow)

All I did was removed the ".Value" part of the event.

0
Thanks, I had a hard time with that part of my script! Cyotokatrov 20 — 9y
Ad

Answer this question