Animator getting funky

local players = game:GetService("Players")
local rep = game:GetService("ReplicatedStorage")

game.ReplicatedStorage.playanim.OnClientEvent:Connect(function()
	local player = game.Players.LocalPlayer
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:FindFirstChild("Humanoid")
	local animator = humanoid:FindFirstChild("Animator")
	local downed = animator:LoadAnimation(script.Dead.AnimationId)
	downed:Play()
	wait(downed.Length)
	game.ReplicatedStorage.unanchor:FireServer()
	downed:Stop()
end)	

then i got:
Unable to cast value to object

Roblox should tell you at which line the error happened

i believe the issue is because you loaded an animation by an animation id, instead of loading it from an animation instance
so change this

local downed = animator:LoadAnimation(script.Dead.AnimationId)

to this

local downed = animator:LoadAnimation(script.Dead)

now it returns no error
but the animation still wont play

Do you mind providing the unanchor script? It seems like that’s causing an issue.

then the problem might be downed.Length, you can instead replace the wait with animation.Stopped:Wait() or with animation.Ended:Wait()

game.ReplicatedStorage.unanchor.OnServerEvent:Connect(function()
								human.Parent.HumanoidRootPart.Anchored = false
								human.AutoRotate = true
							end)

this one worked tho

nope, still nothing happened
the animationID is also valid

i remade the whole script so that it will work but now there are a lot more problem