Humanoid.Animator:LoadAnimation() breaking script?

So on the server of my combat system, I’m creating a stun system, which for the time being only loads an animation into the stunned player. I’ve had issues with the animation not playing outside of studio before (all anims uploaded to the right thing etc.) but this is different, the whole script breaks for some reason whenever I try and do this.

function stun(hum)
	print("running")
	print(hum.Parent)
	local track = hum.Animator:LoadAnimation(Stun)
	track:Play()
end



RemoteAttack.OnServerEvent:Connect(function(plr, tool)
	coroutine.resume(coroutine.create(function()
		local char = plr.Character
		local hrp = char.HumanoidRootPart
		local Hitbox = RayCaster:Initialize(tool, {char})
		Hitbox:DebugMode()
		Hitbox:HitStart()
		Hitbox.OnHit:Connect(function(hit, humanoid)
			local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
			tool.Handle.hit:Play()
			humanoid:TakeDamage(15)
			stun(humanoid)
			Hitbox:HitStop()
		end)
	end))
end)

I’ve tried using the deprecated :LoadAnimation() as that had worked for me before, but to no avail.

Here Animation | Documentation - Roblox Creator Hub
but i’ll also give you a little bit of code so you can see

Hitbox.OnHit:Connect(function(hit)
if hit and hit.parent and hit.Parent:FindFirstChild("Humanoid") and hit:IsNotDescendantOf(Character) then
local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
			tool.Handle.hit:Play()
			humanoid:TakeDamage(15)
			local stun = hit.Parent.Humanoid:LoadAnimation(Stun)
            stun:Play()
			Hitbox:HitStop()
end
			
		end)