Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

LoadCharacter does not use StarterCharacter?

Asked by 4 years ago

I am making a GUI that changes the players' character based on which skin they've chosen. I'm still testing the system, but it seems to not work. When I call player.LoadCharacter() the character reloads to the old one. I've messed around with it and, sure enough, the StarterCharacter is changed. Can someone tell me what I'm doing wrong? I changed the character from a LocalScript. Here's my code:

---Local script------

wait(10)
game:GetService("StarterPlayer").StarterCharacter:Destroy()
game:GetService("ReplicatedStorage").StarterCharacter:Clone().Parent=game:GetService("StarterPlayer")
wait(20)
game:GetService("ReplicatedStorage").RemoteEvent:FireServer(game:GetService("Players").LocalPlayer.Name) 

-----Server script----

game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(p)
    local char = game:GetService("Players"):FindFirstChild(p.Name):LoadCharacter()
end)
0
Same thing happens with loading character after using Player.CharacterAppearanceId jakeke12345 1 — 4y

1 answer

Log in to vote
0
Answered by
waifuSZN 123
4 years ago
Edited 4 years ago

If you haven't already, disable CharacterAutoLoads.

You also want to just load the custom character without deleting the default one, setting that to player.Character, and then parenting the new character in workspace.

You don't need to use remote events at all by the look of it.

0
CharacterAutoLoads does not fix the problem. As far as using player.Character, it's a bad way to do this. I would have to change the camera and when the player resets or dies, the respawn breaks. A remote event is needed as you cannot call LoadCharacter() from inside a LocalScript to my understanding. jakeke12345 1 — 4y
Ad

Answer this question