Numbervalue + 1

I’m new to code and I’m just trying out new functions. why does this not work

local num = game.ServerStorage.Value.Value
while true do
	print(num)
	num + 1
	wait(0.1)
end

[it is a numbervalue]

You’re immediately getting the value in the NumberValue you have, you hae to reference the Value yourself when you want to update it, also that’s not how assignments work, you need to assign the result of num + 1 to something

local num = game.ServerStorage.Value
while true do
	print(num.Value)
	num.Value += 1
	wait(0.1)
end

num.Value += 1 is just a shorthand for num.Value = num.Value + 1

2 Likes