leftready = true
rightready = true
frbready = true
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
Player = script.Parent.Parent
Mouse = Player:GetMouse()
function onKeyDown(key)
local Key = key:lower()
if key == "e" then
print("right punch")
--recharge
if rightready == true then
rightready = false
-- animation
local hum = Player.Character.Humanoid
local anim = hum:LoadAnimation(script.RightPunch.punchanim)
local current = anim
current:Play(.1,1,1)
--right punch
wait(0.3)
current:AdjustSpeed(0)
-- effects
local rightupperarm = script.RightPunch.rightupperarm:clone()
rightupperarm.Parent = game.Players.LocalPlayer.Character["RightUpperArm"]
local rightlowerarm = script.RightPunch.rightlowerarm:clone()
rightlowerarm.Parent = game.Players.LocalPlayer.Character["RightUpperArm"]
wait(0.1)
local hand1 = script.RightPunch.hand1:clone()
hand1.Parent = game.Players.LocalPlayer.Character["RightHand"]
local hand2 = script.RightPunch.hand2:clone()
hand1.Parent = game.Players.LocalPlayer.Character["RightHand"]
local hand3 = script.RightPunch.hand3:clone()
hand1.Parent = game.Players.LocalPlayer.Character["RightHand"]
wait(0.7)
current:AdjustSpeed(1.3)
wait(0.269)
current:AdjustSpeed(0)
wait(0.5)
rightupperarm.Rate = 0
rightlowerarm.Rate = 0
hand1.Rate = 0
hand2.Rate = 0
hand3.Rate = 0
wait(0.3)
current:AdjustSpeed(1)
rightupperarm:Remove()
rightlowerarm:Remove()
hand1:remove()
hand2:remove()
hand3:remove()
rightready = true
elseif key == "q" then
--recharge
if leftready == true then
leftready = false
--animation
local hum = Player.Character.Humanoid
local anim = hum:LoadAnimation(script.LeftPunch.greger)
local current = anim
current:Play(.1,1.5,1)
-- left punch
wait(0.3)
current:AdjustSpeed(0)
local rightupperarm = script.LeftPunch.rightupperarm:clone()
rightupperarm.Parent = game.Players.LocalPlayer.Character["LeftUpperArm"]
local rightlowerarm = script.LeftPunch.rightlowerarm:clone()
rightlowerarm.Parent = game.Players.LocalPlayer.Character["LeftUpperArm"]
wait(0.7)
local hand1 = script.LeftPunch.hand1:clone()
hand1.Parent = game.Players.LocalPlayer.Character["LeftHand"]
local hand2 = script.LeftPunch.hand2:clone()
hand1.Parent = game.Players.LocalPlayer.Character["LeftHand"]
local hand3 = script.LeftPunch.hand3:clone()
hand1.Parent = game.Players.LocalPlayer.Character["LeftHand"]
local hand4 = script.LeftPunch.hand4:clone()
hand1.Parent = game.Players.LocalPlayer.Character["LeftHand"]
wait(0.7)
current:AdjustSpeed(1.3)
wait(0.269)
current:AdjustSpeed(0)
wait(0.5)
rightupperarm.Rate = 0
rightlowerarm.Rate = 0
hand1.Rate = 0
hand2.Rate = 0
hand3.Rate = 0
hand4.Rate = 0
wait(0.3)
current:AdjustSpeed(1)
rightupperarm:Remove()
rightlowerarm:Remove()
hand1:remove()
hand2:remove()
hand3:remove()
hand4:remove()
leftready = true
end
end
end
end
script.Parent.Touched:connect(function(Part)
local Human = Part.Parent.Parent.Parent:FindFirstChild("Humanoid")
if Human and Human.Parent.Name ~= Character.Name then
Human:TakeDamage(20)
end
end)
Mouse.KeyDown:connect(onKeyDown)
I'm trying to make it where the player damages other players/npcs when you press the key.

2 comments
Using mouse.KeyDown is deprecated, use UserInputService.
btw use KeyframeReached its easier and u dont need waits