local player = game.Players.LocalPlayer
mouse = player:GetMouse()
local damage = 5
function leftpunch()
local leftpunch = player:findFirstChild("Left Arm")
leftpunch.Position.Vector3.new(30.422, 179.001, 138.099)
leftpunch.Rotation.Vector3.new(90.161, 17.144, -53.438)
wait(1)
leftpunch.Position.Vector3.new(37.5, 179.8, 146.003)
leftpunch.Rotation.Vector3.new(179.669, -0, 180)
end
function keyDown(key)
if key=="z" then
leftpunch()
if leftpunch():onTouched(player) then
local hum = player:findFirstChild("Humanoid")
player.Humanoid.Health:TakeDamage(damage)
end
end
end
script.Parent.mouse:connect(keyDown)
When you press z, you left punch, But it's not working. Why? Can you explain why too?

1 comment
KeyDown is deprecated, and shouldn't be used anymore in any circumstance; use the UserInputService instead: http://wiki.roblox.com/index.php?title=API:Class/UserInputService :)