StarterCharacters per player (local startercharacter)

I’m creating a game where your character changes into different characters based on how much XP you have (to keep it short). I’m trying to use StarterCharacter to morph the R15 players into the correct morph since R15 players are made up of MeshParts and MeshIds can’t be changed through scripts.

This is my code in StarterPlayer to change the StarterCharacter locally when it’s time to switch morphs:

game.ReplicatedStorage.Functions.UpdateRobot.OnClientInvoke = function()
print("updating robo appearance")
local newRobot = game.ReplicatedStorage.RobotArmors[Utils.CalculateLevel(game.ReplicatedStorage.Functions.GetPlayerStat:InvokeServer("XP"))]:Clone()

if player.UserId > 0 then
	for i, v in pairs(game.Players:GetCharacterAppearanceAsync(game.Players.LocalPlayer.UserId):GetChildren()) do
		v.Parent = newRobot
	end
end

if game.StarterPlayer:FindFirstChild("StarterCharacter") then
	game.StarterPlayer.StarterCharacter:Destroy()
end

newRobot.Name = "StarterCharacter"
newRobot.Parent = game.StarterPlayer
return true
end

This works fine in Play Solo and in test servers it correctly changes the StarterCharacter, but in live games and test servers it doesn’t use the StarterCharacter when the player respawns. Is this because the StarterCharacter has to be set on the server and not on the client?

That seems like it’s the issue.

You’ll probably need to make a custom character loading system.

2 Likes

Do you know of any good ways to replace the mesh parts in a character model without killing the player?

There is only one solution that I can guarantee will work – set the transparency of all the normal parts to 1, then add new parts and weld them to their corresponding body parts

Anything else will probably result in breaking/modifying the core joints, which would kill the character. I have an additional idea, and that could be to set the core joints’ part properties to the new parts, one at a time so nothing is broken in one go. That may not work, though.

1 Like

Thank you, I will try both of these

2 Likes

you would have to test this, but maybe you could disable the dead state of the humanoid (i would do it both server and client if you have filtering enabled) then do the changing of parts, then rebuild the joints, and then turn humanoids death on again. I have never done this, but its something you might look into.

StarterCharacter isn’t for this purpose. You’ll need a custom character loading system.

Also to note, you’ve posted a thread similar to this one and received an appropriate answer as to how to accomplish your goal. The question doesn’t really differ between that post and this one.

Also see:
https://devforum.roblox.com/t/how-do-you-morph-an-r15-character/43611
(will post relevant information if you can’t view this)

You should also not be deciding the character’s appearance on the client.

2 Likes

Sorry about the double post, I think I just overlooked the first reply or something, that would’ve helped to just stop and look at it lol.

1 Like