Just got back into scripting i was never good at it but i wanted to know what was wrong with my script it throws the first punch but then it wont do the animation again
what i want to do is separate punches and kicks so you can do sick combos
CanDoDmg = true
RPC = true -- right punch Cooldown
LPC = true --Left punch Cooldown
LKC = true --Left Kick Cooldown
RKC = true --Right Kick Cooldown
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
RP = "e" -- Right Punch KeyBind
LP = "q" -- Left Punch KeyBind
Rk = "g" -- Right Kick Keybind
LK = "f" -- Left Kick Keybind
RPdmg = 10 -- Right Punch Dmg
LPdmg = 7 -- Left Punch Dmg
RKdmg = 15 --Right Kick Dmg
LKdmg = 13 --Left Kick Dmg
mouse.KeyDown:Connect(function(key)
if key == RP and RPC == true then
RPC = false
local anim = script.Parent.Humanoid:LoadAnimation(script.RPAnim)
anim:Play()
script.Parent.RightHand.Touched:connect(function(hit)
if hit.Parent.Humanoid and CanDoDmg == true then
hit.Parent.Humanoid:TakeDamage(RPdmg)
CanDoDmg = false
wait(2)
RPC = true
CanDoDmg = true
end
end)
end
end)
mouse.KeyDown:Connect(function(Lkey)
if Lkey == LP and LPC == true then
LPC = false
local anim = script.Parent.Humanoid:LoadAnimation(script.LPAnim)
anim:Play()
script.Parent.LeftHand.Touched:connect(function(hit)
if hit.Parent.Humanoid and CanDoDmg == true then
hit.Parent.Humanoid:TakeDamage(LPdmg)
CanDoDmg = false
wait(1)
LPC = true
CanDoDmg = true
end
end)
end
end)
