Differences in Adding With Int Values

Hi! I have been running into some weird issues with Int values. So I come here to ask what is the difference between these two sets of code.

Set 1

local intValue = Instance.new("IntValue")
intValue.Value = 1

Set 2

local intValue = Instance.new("IntValue").Value
intValue = 1

For the first one, you’re actually changing the value property. For the second one, you’re saying that the value is equal to 1. Essentially like 0 = 1.

3 Likes

The second one does not work. More explanation. For the first one, the intvalue has been defined. But for the second one, you are setting a variable with the value nil to 1.

2 Likes

Aw, you beat me to it! (30charsss)

1 Like