RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a combat system with a 5 hit rule with animations r6"
-- local script local player = game.Players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://animationid" -- replace with your animation id local animationTrack = humanoid:LoadAnimation(animation) local hitCount = 0 local function onKeyPress(input) if input.KeyCode == Enum.KeyCode.E then if hitCount < 5 then animationTrack:Play() hitCount = hitCount + 1 else print("You've hit the maximum number of hits") end end end game:GetService("UserInputService").InputBegan:Connect(onKeyPress) humanoid.Died:Connect(function() hitCount = 0 end)