I am in the midddle of making a game, I recently added a kick move and animation, which works fine, but now for some reason if I punch, the Punch animation will loop forever and I have no idea why, any ideas as to why this happening? Im new to scripting sorry
I am just running it using Studio
Clientside Script
local UserInputService = game:GetService("UserInputService")
local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Humanoid = Char.Humanoid
local Hit = script:WaitForChild("Hit")
local Re = game:GetService("ReplicatedStorage").Punch
local Punch = game:GetService("ReplicatedStorage").PunchAnim
local Debounce = true
local Cooldown = 2
local Key = 'E'
UserInputService.InputBegan:Connect(function(input, Istyping)
if Istyping then return end
if input.KeyCode == Enum.KeyCode[Key] and Debounce and Char then
Debounce = false
local Load = Humanoid:LoadAnimation(Punch)
Load:Play()
if Load.IsPlaying and not Hit.Value then
Re:FireServer()
end
wait(Cooldown)
Debounce = true
end
end)
Server Script
local Combat = game:GetService("ReplicatedStorage").Punch
local plr = game.Players.LocalPlayer
Combat.OnServerEvent:Connect(function(plr)
local Char = plr.Character or plr.CharacterAdded:Wait()
if not Char.Punch.Hit.Value then
Char.Punch.Hit.Value = true
local A = true
Char.LeftHand.Touched:Connect(function(h)
if A and h.Parent.Name ~= plr.Name and h.Parent:FindFirstChild("Humanoid") then
A = false
local E = h.Parent.Humanoid
E:TakeDamage(4)
wait(3)
A = true
Char.Punch.Hit.Value = false
end
end)
end
end)
I think I might have missed something obvious I can also post the Kick scripts if you want/need them.

1 comment
When you have export your animation the loop was be coched