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

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

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

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

1 comment

0

Oh my god wow. I can't believe I didn't catch that error. Thanks!

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