I'm trying to make a combat system but leftFist still damages even after the animation has played.
Client:
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local LPcooldown = false
UIS.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.Q then
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local leftPunch = script.LeftPunch
local LPTrack = humanoid:LoadAnimation(leftPunch)
if not LPcooldown then
LPcooldown = true
LPTrack:Play()
game.ReplicatedStorage.LPRemote:FireServer()
wait(1)
LPcooldown = false
end
end
end)
Damage Script:
game.Players.PlayerAdded:Connect(function(player)
local function LPDamage()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local leftFist = character:WaitForChild("Left Arm")
leftFist.Touched:Connect(function(hit)
end)
end
game.ReplicatedStorage.LPRemote.OnServerEvent:Connect(LPDamage)
end)
