Spawning as a custom character based on team?

Hello fellow Robloxians. I am having some issues figuring out how to spawn a custom character based on what team you are on. In my game, I have a humans and a zombies team. I obviously want to spawn the players on the zombie team as one of my zombie models, but I can’t seem to get it working.

P.S. the “undead” variable is my ‘ReplicatedStorage.Zombies’ folder

Here is my code (I'm sorry if it looks bad lol)

This is the error I keep getting

Zombie model


During testing, the players character gets deleted and the zombie character appears. The only issue that happens is the zombie character doesn’t CFrame to the correct spot, the camera doesn’t move to the zombie, and the zombie character doesn’t move.

I have searched every where for answers and I can’t find anything that helps me. The only thing that I have found that is similar to this, is changing the starter character but that’s not what I want to do. I also have considered disabling character auto loading and creating my own spawning system, but I’m afraid this issue is going to persist. I’m unsure what to do from here so this is my last resort. Thank you for your time and help :slight_smile:


Try setting the character model’s PrimaryPart to the HumanoidRootPart. Then you can move your model by calling:

1 Like

Doing this from command line seemed to work just fine when I was trying to spawn a custom character; I didn’t need to edit any of the camera settings it just linked straight to the model and I could move fine. Just have to make sure you have the PrimaryPart set.

local plr = game.Players.Siren10; plr.Character:ClearAllChildren(); plr.Character = game.ReplicatedStorage.Characters.Shadow:Clone(); plr.Character.Parent = workspace

however, accessories didn’t seem to stay attached.


First of all, you don’t need to apologize if you think your code isnt the cleanest, we are here in order to make you better not put you down.

Second, would it be possible for you to give us a game file of what you need fixing (and nothing more) or perhaps a screenshot of your explorer so we can better replicate it? Thanks!


okay interesting. I’ll try messing with it the way you did it and I’ll let you know what happens

I can definitely work on a separate game file with my issue. I’ll get it up in a little bit

1 Like

@Siren10’s code actually made it spawn, but it isn’t fully working.

@NodeSupport, I created a separate game file.

Here it is:
CustomCharacter.rbxl (25.0 KB)

Edit: I forgot to mention that the “Escape” and “Survivor” folders just contain scripts for the different zombies stats.

Hello! Good luck on your project.
I see you are changing PrimaryPart via code, but could you try setting it first, during the edit? Via using Explorer and Properties. Not sure if it would work but worth a try.
Second, can you check if it finds HumanoidRootPart after spawning? And right before getting PrimaryPart’s CFrame. Maybe it gets deleted somehow? Maybe you forgot to rig so it falls down? It’s better to check!

Hey! I actually did change the PrimaryPart via Explorer and Properties after I noticed it was possible yesterday haha. It ended up returning the same error, but I eventually figured it out! For some reason when I changed the PrimaryPart to the head and turned off Anchored on the HumanoidRootPart, it worked. When I went to apply these changed to my game, it still didn’t work. I then realized that the Player.Character:ClearAllChildren() was actually being run before the character had fully loaded. That means the character would finish loading with like 1 or two things left and that’s why it couldn’t find the characters PrimaryPart.

Here is the new, fixed place if anyone is wondering:
CustomCharacter.rbxl (25.1 KB)

Thank you so much for everyone’s help!


Glad it helped, and I’m also glad you got it figured out from there.

This doesn’t work anymore at the moment, it says “Oops page not available”.