I want the amount of damage you do to be based on your 'strength' in leaderstats and 'rebirths' which is also in leaderstats
For example if you have 1000 strength you do 1000 damage and if you have 1 rebirth you do double that amount(2k) and if you have 2 rebirths you do 4x that amount(4k)
This is what i have so far
local canDoDmg = false
local dmg = 25
local db = false
local Plr = game.Players.LocalPlayer
local Stats = Plr:WaitForChild("leaderstats")
local Strength = Stats:FindFirstChild("strength")
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
hit.Parent.Humanoid:TakeDamage(dmg*Strength)
end
end)
delay(1, function()
canDoDmg = false
db = false
end)
wait(10)
end
end)
i got this error on line 22 attempt to perform arithmetic (mul) on number and Instance

4 comments
dmg is the base damage you do when a new player joins. Also how would i get the strength value from leaderstats i tried -- local strength = Plr.leaderstats.strength.Value and i put in your script and got the error attempt to index number with 'Value' line 23 or in your script line 6
the point is that you should not do local strength = Plr.leaderstats.strength.Value but local strength = Plr.leaderstats.strength and then only doing Strength.Value on line 6 to get the newest value. I did not change anything before the script i showed so do not change anything there. if dmg is the damage and Strength.Value is rebirths then you would reverse the values from line 6 to line 9.
Ok i think i get it now i changed line 6 to local TotalDamage = dmg + Strength.Value then on line 8 i changed dmg to rb(rebirths) so what i think is happening is that dmg is 25 and if your strength value is 1000 your total damage is 1,025 and for each rebirth it goes up by 2 so 1 rebirth is 2050 total damage and 3 rebirths is 4,100... i think im still new to this, im working on a npc to check
yea looks like rebirth dont affect anything i even gave myself billions of rebirths, im completely clueless on how to do this