- I’m making a JoJo game and I need to stock damage to for my Time Stop, to then damage the player, I already tried to add into an intvalue but It didn’t go so well. Which is the best way to stock damage?
If you’re asking about how you can go about stacking damage, using an IntValue
should be fine. What was the problem you came across?
For some reason the intvalue wasn’t changing Its value. If you wish I could show you the code
You can change the value of an IntValue
using it’s Value
property.
IntValue.Value += damage
Perhaps you did something like this?
local damage = IntValue.Value
damage += 5
If so then damage
is a reference to the current value, not the instance, so if changed the value of IntValue
won’t change as well. Instead, you must do:
local damage = IntValue
damage.Value += 5
I ain’t sure what is the issue with my code
local TSDamage = ehum.Parent:FindFirstChild("TSDamage")
if TSDamage then
TSDamage.Value -= 0.05
elseif not TSDamage then
local TsDamage = Instance.new("IntValue")
TsDamage.Name = "TSDamage"
TsDamage.Parent = ehum.Parent
TsDamage.Value = ehum.Health
The “Int” in IntValue
stands for integers. Integers are whole numbers, which can’t carry decimals.
Use a NumberValue
instead.
Problem is, I can’t do aritmethics on the numbervalue
What? How so?
[character minimum]
When I try to do aritmethics on a numbervalue.value I get the issue “Error, can’t do (sub) on numbervalue and instance”
You definitely can.
local NumberValue = Instance.new("NumberValue")
NumberValue.Value -= 0.05
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.