So basically im just raycasting and trying to see if the thing I hit contains a humanoidrootpart it works but it for some reason delays animations im going to play and its really weird not sure what the problem is here honestly, anyways heres the code for it, when I remove the hit.Parent:FindFirstChild(“HumanoidRootPart”) it works when I spam the key and theres no delay
Delayed Animation Code
uis.InputBegan:Connect(function(i,t)
if t then return end
if i.KeyCode == Enum.KeyCode.E then
local combatRay = Ray.new(humrp.Position,humrp.CFrame.lookVector * 7)
local hit,position = workspace:FindPartOnRayWithIgnoreList(combatRay,{char})
if hit and hit.Parent:FindFirstChild("HumanoidRootPart")then
if Combo == 0 then
hum:LoadAnimation(script.left.LeftPunch1):Play()
Combo += 1
elseif Combo == 1 then
hum:LoadAnimation(script.right.RightPunch1):Play()
Combo += 1
end
if Combo == 2 then
Combo = 0
end
end
end
end)
Removing the FindFirstChild part from the check