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

Attempt to perform arithmetic (sub) on userdata and number?

So I have this code right here;

db_value.Value = db
repeat wait()
db_value.Value =  db_value -1 --> Error line.
print(db)
until db_value.Value == 0
end

It's a simple debounce script that's supposed to update a value every second, but when I click the button firing the remote I get the following error; 8: attempt to perform arithmetic (sub) on userdata and number How can I fix this and what does it mean in this context because it's not userdata, it's an intvalue.

1 answer

You are not subtracting from the db_value's value, but the db_value itself.

db_value.Value = db
repeat wait()
db_value.Value =  db_value.Value  -1 
print(db)
until db_value.Value == 0
end

1 comment

0

yea

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