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

Comparing IntValues with a number?

Asked by 10 years ago
local players = game.Players:GetChildren()
local plr3 = players[3]
local statp3 = plr3.Character:WaitForChild("Ow").Value
if statp3 == 1 then
                statp3 = 3
            elseif statp3 == 0 then
                statp3 = 2
            end

statp3 is an IntValue inside the player's character. Whenever i kill someone i want it to change to a certain number determined by what the statp3 number currently is. But even when statp3 == 1 it still skips it and goes to the elseif line and changes statp3 to 2.

1 answer

Log in to vote
0
Answered by 10 years ago

If statp3 is an IntValue, the issue you're having is that statp3 is an object, not a number! To get the number out of the object, use statp3.Value, and similarly, to set it, use statp3.Value=num.

Ad

Answer this question