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

Is thee a way to Increment a number Value?

I already understand that making a number value its own value + a number adds one, same situation with humanoid.Health = Humanoid.Health + a number, and for humanoid.health you can do humanoid:TakeDamage(a number, if you want to add health make this negative number), but is there a way to do that with number values? maybe like ValueName.Value:Increment(1)?

1 answer

✓ Accepted answer

No. There is not. But if you really wanted to do this you can do something like this:

local function inc(valueBase, num)
	valueBase.Value = valueBase.Value + (num or 1) --// if no argument is passed default to 1
	return valueBase.Value --// just incase you need the new value
end

Pretty self explanatory. I write this as I am in school so if you need anything I'll get back to you asap.

1 comment

0

thanks, so i guess the original thing i said is the only way, ok that all :)

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