I made a script where as long as it's activated, a loop runs to increase IntValueA by IntValueB.
For Example: IntValueA = 0 IntValueB = 10
The first loop runs, and IntValueA is now 10, it runs again and it becomes 20. Normal and works perfect. If I change IntValueB however, it still increases by 10 instead of whatever I set it to. Why?? Also, Damage is IntValueB, Charge is IntValueA.
local debounce = false
local damage = script.Parent.Damage
script.Parent.Activated:Connect(function()
if debounce==false then
debounce = true
script.Parent.Charging.Value = true
while script.Parent.Charging.Value==true do
print(damage.Value)
script.Parent.Charge.Value = script.Parent.Charge.Value +(damage.Value)
print ("obama")
if script.Parent.Charging.Value==false then
break
end
wait(1)
end
end
end)
script.Parent.Deactivated:Connect(function()
print ("Nobama")
script.Parent.Charging.Value = false
wait(0.5)
script.Parent.Charge.Value = 0
wait(1.5)
debounce = false
end)

2 comments
Is this a Script or a LocalScript? If this is a Script and you are updating Damage on the client then this script wont see any changes as it wont be replicated. You would want to look at updating it via RemoteEvent if this is the case
updated my answer