RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make that my arms doesn't make damage until the animation plays"
-- local script local player = game.Players.LocalPlayer local character = player.Character local humanoid = character:FindFirstChild("Humanoid") local animTrack1 = humanoid:LoadAnimation(anim1) local animTrack2 = humanoid:LoadAnimation(anim2) local punching = false local punchCount = 0 local canPunch = true local hitCharacters = {} local function punch() if canPunch then local arm = character:FindFirstChild(punching and "Left Arm" or "Right Arm") arm.Touched:Connect(function(part) local otherCharacter = part.Parent local otherHumanoid = otherCharacter:FindFirstChildWhichIsA("Humanoid") if otherHumanoid and not hitCharacters[otherCharacter] and (animTrack1.IsPlaying or animTrack2.IsPlaying) then hitCharacters[otherCharacter] = true otherHumanoid:TakeDamage(10) wait(1) hitCharacters[otherCharacter] = nil end end) punching = not punching local animTrack = punching and animTrack1 or animTrack2 animTrack:Stop() animTrack:Play() punchCount = punchCount + 1 if punchCount >= 4 then canPunch = false wait(2) canPunch = true punchCount = 0 end end end game:GetService("UserInputService").InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.E then if not animTrack1.IsPlaying and not animTrack2.IsPlaying then punch() end end end)