Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Thanks, I had a hard time with that part of my script!

This discussion is preserved as it was. New answers, comments, and votes are closed.