StarterCharacter showing up for everyone

I am creating this custom character model that has different types of characters appear depending on which team you choose.

ReplicatedStorage.CreateHumanoid.OnServerEvent:Connect(function(player)
	local oldHumanoid = game.ServerStorage.CustomCharacter
	local newHumanoid = oldHumanoid:Clone()
	newHumanoid.Name = "StarterCharacter"
	newHumanoid.Parent = game.StarterPlayer
	game.Workspace[player.Name].Animate:Destroy()
end)

The problem is: when player A chooses team A, the “StarterCharacter” will go into everybodies StarterPlayer, therefore making everyone look the same. Is there a way to change this script so that once Player A selects team A, ONLY his or her character changes?

1 Like

It is kind of obvious the reason, Its because the StarterPlayer goes to every player.

To change this you can Parent the CustomCharacter to the player DIRECTLY (Use the player parameter you’ve set there)

And then you do player:LoadCharacter(CustomCharacter)

Do you mean I do it so that

newHumanoid.Parent = game.Players[player.Name]

You can just do newHumanoid.Parent = player and it will work fine

Doing that makes it so that it returns my normal humanoid? Here is my revised script:

ReplicatedStorage.CreateHumanoid.OnServerEvent:Connect(function(player)
	local oldHumanoid = game.ServerStorage.Macrophage
	local newHumanoid = oldHumanoid:Clone()
	newHumanoid.Name = "Custom"
	newHumanoid.Parent = player
	player:LoadCharacter("Custom")
	workspace[player.Name].Animate:Destroy()
end)

It seems that it makes my default roblox avatar appear.

You dont do player:LoadCharacter(“Custom”), you do player:LoadCharacter(newHumanoid)

(You dont need to use the string)
And you should name newHumanoid to StarterCharacter instead of Custom

Instead of making workspace[player.Name] you should do player.Character

And then do I parent newHumanoid to the player’s workspace character? or the Players Service

You parent to the player. You should learn more of how to use events and objects.

The parameter you put on OnServerEvent is the player instance, player.Character gets the character thats on workspace.

So you would have to parent it to the player so you can load it.

I did what you said? It still returns my default roblox avatar though. Here is a screenshot:


My revised script:

ReplicatedStorage.CreateHumanoid.OnServerEvent:Connect(function(player)
	local oldHumanoid = game.ServerStorage.Macrophage
	local newHumanoid = oldHumanoid:Clone()
	newHumanoid.Name = "StarterCharacter"
	newHumanoid.Parent = player
	player:LoadCharacter(newHumanoid)
	workspace[player.Name].Animate:Destroy()
end)

Oh wait actually you only need to switch this

with this:

player.Character = newHumanoid
player.Character.Animate:Destroy()

When I change my code to your code, nothing shows up, it seems like the Player Character did not load at all.

Oh its because player.Character.Animate doesnt exist

See if this can help you Replacing the default character with a custom character