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

Can't perform arithmetic on an IntValue!!?!?!?!?

Asked by 10 years ago

So right now, I'm in the middle of making a game. And I'm pretty annoyed and ticked off because this stupid error won't let me continue making the game.

I recreated the code in a separate script for debugging and apparently ROBLOX won't let me perform arithmetic.

I literally have no idea why it's not letting me perform arithmetic on and IntValue. If anyone could help, that would be great.

Here's the code:

NumKilled = game.Workspace.vars.NumKilled

while true do
    wait()
    NumKilled.Value = NumKilled + 1
end

Here's the error that it produces: http://prntscr.com/3onssf

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

NumKilled is an object.

An object is not a number.

You need to add 1 to the object's value, not the object itself.

NumKilled = game.Workspace.vars.NumKilled

while true do
    wait()
    NumKilled.Value = NumKilled.Value + 1
end
0
Oh my god wow. I can't believe I didn't catch that error. Thanks! McCorus 5 — 10y
Ad

Answer this question