Why doesn't my character change?

Hello,
I’m trying to make a custom character for each team, but it doesn’t seem to work with my character. I tried testing with a dummy and it worked perfectly fine. So what did I do wrong?
Script:

game.Players.PlayerAdded:Connect(function(player)
	local character = player.Character or player.CharacterAdded:Wait()
	local Team = game:GetService("Teams")
	local Characters = game:GetService("ServerStorage"):WaitForChild("Characters")
		
	if player.Team == Team.Red then
		local oldModel = character
		local oldCFrame = oldModel:GetPrimaryPartCFrame()

		local newCharacter = Characters.Red:Clone()
		newCharacter.Parent = workspace
		--newCharacter:SetPrimaryPartCFrame(oldCFrame)
		newCharacter.HumanoidRootPart.Position = character.HumanoidRootPart.Position
		player.Character = newCharacter
	elseif player.Team == Team.Blue then
		print("Blue")
	end
end)

This is a server script in server script service

When I spawn as the character I want:


How my character looks like:
Screenshot 2021-11-15 085412
What’s inside my character:
Screenshot 2021-11-15 085508
Thank you in advance.

The character needs to be named StarterCharacter and placed in the StarterPlayer folder.

If each team has a different starter character, you need to swap this model out via script

2 Likes
game.Players.PlayerAdded:Connect(function(player)
	local character = player.Character or player.CharacterAdded:Wait()
	local Team = game:GetService("Teams")
	local Characters = game:GetService("ServerStorage"):WaitForChild("Characters")

	if player.Team.Name == "Red" then
		if game.StarterPlayer:FindFirstChild("StarterCharacter") then
			
		else
			local newCharacter = Characters.Red.StarterCharacter:Clone()
			newCharacter.Parent = game.StarterPlayer
			player:LoadCharacter()
		end
		
		player:LoadCharacter()
	elseif player.Team.Name == "Blue" then
		if game.StarterPlayer:FindFirstChild("StarterCharacter") then

		else
			local newCharacter = Characters.Blue.StarterCharacter:Clone()
			newCharacter.Parent = game.StarterPlayer
			player:LoadCharacter()
		end
	end
end)
2 Likes