'LoadCharacter()" function resets my player to the default one instead of changing it to the clone I set?

Continued: And when I remove the LoadCharacter() the clone loads as the character but the animations do not work.

local kage = {

    Leaf = "Hokage",
    Sand = "Kazekage",
    Mist = "Mizukage",
    Clouds = "Raikage",
    Stone = "Tsuchikage"

}



game.ReplicatedStorage.spawn.OnServerEvent:Connect(function(plr, village)
    print(village)

    workspace:FindFirstChild(village).Value += 1
    print(workspace:FindFirstChild(village).Value)
    local starter = game.ReplicatedStorage:FindFirstChild(village).StarterCharacter

    local clone = starter:Clone()

    local kageclone = starter:Clone()



    plr.Village.Value = village
    local hat = game.ReplicatedStorage:FindFirstChild(village).Accessory:Clone()

    if workspace:FindFirstChild(village).Value == 1 then
        
        plr.Title.Value = kage[village]
        print("hello")
        
        for i,v in pairs(kageclone:GetChildren()) do
            if v:IsA("Accessory") then
                v:Destroy()
            end
        end

        hat.Parent = kageclone
        wait()
        kageclone.Name = plr.Name
        plr.Character = kageclone
        kageclone.Parent = workspace
        task.wait()
    
        
        plr:LoadCharacter(kageclone)
        print("Goodbye")
    else
        
        wait()
        clone.Name = plr.Name
        plr.Character = clone
        clone.Parent = workspace
        wait()
        plr:LoadCharacter(clone)
    end

    plr.Team = game.Teams:FindFirstChild(village)
    wait()
    
end)

game.Players.PlayerRemoving:Connect(function(plr)
    if plr.Village.Value ~= "None" then
        workspace:FindFirstChild(plr.Village.Value).Value -= 1
    end
end)
1 Like

loadcharacter has no parameters, it’s only purpose is to respawn the character
https://create.roblox.com/docs/reference/engine/classes/Player#LoadCharacter

1 Like

When I do not use the loadcharacter thing, the animations do not work. How do I get around this?

1 Like

if it’s just animations you want to change, you could look into something like this Using Animations | Roblox Creator Documentation

1 Like