How to give network ownership of custom body?

So I have game.Players.CharacterAutoLoads disabled.
Whenever the player joins, they are given a custom body.

This is, however, annoying when dealing with animations.

Server sided character animation scripts aren’t super smooth, so I need to have my character animations be done through a LocalScript.

I would like to give the player’s client side full control/network ownership of the player’s custom character body.

I don’t understand what’s wrong with my code.

My code:

game.Players.PlayerAdded:Connect(function(player)
    local body = script.DefaultBody:Clone()
    body.Name = player.Name
    player.Character = body
    body.Parent = workspace

    for i,v in pairs(body:GetChildren()) do
        if v:IsA("BasePart") then
            v:SetNetworkOwner(player)
        end
    end

end)

I have made a script that replicates animations via the server side, but it is not very smooth.
I want a better way

Naming the model “StarterCharacter” and parenting it to StarterPlayer will force all players to use a clone of that character model. Roblox will then handle network ownership, animations, and character assignment.

4 Likes