so i am trying too make a punch script that does damage according to eaderstats, and instead of increasing it just kills me when i touch the root part of a humanoid NOTE: this is a localscript
player = game.Players.localPlayer
local Char
repeat
Char = player.Character
wait()
until Char
local Humanoid = Char:WaitForChild("Humanoid")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local dmg = true
Mouse.KeyDown:connect(function(key)
if key == "q" then
local an = script.Parent.Humanoid:LoadAnimation(script.Animation)
an:Play()
script.Parent.LeftHand.Touched:connect(function(hit)
local Player = game.Players.LocalPlayer
local LB = Player:WaitForChild("leaderstats")
local p = LB:WaitForChild("Power")
local damage = 0.1 * p.Value
wait(1)
Humanoid:TakeDamage(damage)
dmg = false
wait(1)
dmg = true
end)
end
end)

2 comments
you can touch humanoids?! O_O!!!!
ok, next time try using User Input service instead of mouse.KeyDown