Here is my punch script. Basically i want a new player to join the game and start off with 0 damage which is the (dmg) variable i set it to 25 for testing. And as you play the game you get strength(strength = Plr.leaderstats.strength) and the more strength the more dmg so 1k strength is 1k damage. I also want damage to be based off of rebirths(rb = Plr.leaderstats.rebirths.Value) so 1 rebirth doubles your damage so 1k strength and 1 rebirth is 2k damage and 2 rebirths will be 4x damage and 3 will be 6k damage. But for some reason changing my rebirths doesnt change the damage output and idk why.
local canDoDmg = false
local dmg = 25
local db = false
local Plr = game.Players.LocalPlayer
local strength = Plr.leaderstats.strength
local rb = Plr.leaderstats.rebirths.Value
local UserInputService = game:GetService("UserInputService")
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://6203475027"
local track = Humanoid:LoadAnimation(Anim)
UserInputService.InputBegan:Connect(function(InputObject)
if InputObject.UserInputType == Enum.UserInputType.MouseButton1 and db == false then
track:Play()
canDoDmg = true
db = true
script.Parent.RightHand.Touched:connect(function(hit)
if hit.Parent.Humanoid and canDoDmg == true then
local TotalDamage = dmg -- default value with 0 rebirths
for i = 1, rb do
TotalDamage *= 2
end
hit.Parent.Humanoid:TakeDamage(TotalDamage)
end
end)
delay(1, function()
canDoDmg = false
db = false
end)
wait(10)
end
end)

3 comments
ok i tested it and when you gain strength it doesnt increase the damage but when you rebirth it does
Thats because dmg is a constant value, you didnt base it off strength.
Change line 23 to reflect the strength variable.