mouse.Parent may not be the player character so do it like so
local loadedanim = Player.Character:FindFirstChild("Humanoid"):LoadAnimation(animation)
local loadedanim2 = Mouse.Parent:FindFirstChild("Humanoid"):LoadAnimation(animation2)
if loadedanim and loadedanim2 then
loadedanim:Play()
loadedanim2:Play()
end
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local debounce = false
local event = game.ReplicatedStorage.AbilityEvents.NeckSnap
local root = Player.Character.HumanoidRootPart
Mouse.KeyDown:Connect(function(key, IsTyping)
if IsTyping then return end
key:lower()
if key == 'z' and debounce == false then
debounce = true
if (Mouse.Target.Position - root.Position).magnitude <15 and debounce == true and Player.Character.Humanoid.ragdoll.Value == false and not Player.Character.Humanoid.PlatformStand and Player.Character.Humanoid.Health > 0 then
event:FireServer(Mouse.Target)
wait(10)
debounce = false
end
end
end)