Problem With Changing StarterCharacters For Specific Teams

I am trying to get this bug with my code fixed.

local Game = game
local Players = Game:GetService("Players")
local Teams = Game:GetService("Teams")
local ServerStorage = Game:GetService("ServerStorage")
local RedTeam = Teams.Red --Red team.
local BlueTeam = Teams.Blue --Blue team.
local RedCharacter = ServerStorage.RedCharacter --Character model for red team.
local BlueCharacter = ServerStorage.BlueChar --Character model for blue team.

local function OnPlayerAdded(Player)
	local function OnCharacterAdded(Character)
		if Player.Team == RedTeam then
			Player.Character = RedCharacter --Override character with team's custom character.
		elseif Player.Team == BlueTeam then
			Player.Character = BlueCharacter --Override character with team's custom character.
		end
	end

	Player.CharacterAdded:Connect(OnCharacterAdded)
end

Players.PlayerAdded:Connect(OnPlayerAdded)

The problem with my code is with what happens when the player loads in, they’re met with not being able to move or interact with their environment

Also, I am using ACS 1.7.5.

If the script cannot be compatible with ACS 1.7.5 then please tell me. Thanks!

Have you checked if some parts inside the character are anchored? Maybe root part? Also I cleaned up your code, this should be way more efficient

local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local ServerStorage = game:GetService("ServerStorage")

local function OnPlayerAdded(Player : Player)
	Player.CharacterAdded:Connect(function()
		if Player.Team == Teams.Red or Player.Team == Teams.Blue then
			local NewCharacter = (Player.Team == Teams.Red and ServerStorage.RedCharacter or ServerStorage.BlueCharacter):Clone()
			NewCharacter.Name = Player.Name

			Player.Character = NewCharacter
			NewCharacter.Parent = workspace

			-- Wait after spawning the character
			Player.CharacterAdded:Wait()
		end
	end)
end

Players.PlayerAdded:Connect(OnPlayerAdded)
2 Likes

Also you could clone the animate script from old character into the new one, or have custom Animate script inside the new character

1 Like

Double check that parts inside the character models aren’t anchored, that you aren’t missing a humanoid and that humanoid speed isn’t set to 0.

Also I coded this thing myself, here is the model link for it: https://create.roblox.com/store/asset/111990230573203/CustomTeamCharacters

1 Like

This works…

But I’m using ACS 1.7.5, and it gives this error.

image

Would you mind sending me a rbxm or rbxl file with all the necessary components so I can better diagnose the issue?

1 Like

It is over the 10MB limit.

How can I send it?

Sorry I don’t think I can help you further as this error is completely unrelated to your original question

I told you that there could be compatibility issues with some scripts due to ACS 1.7.5, which, is why I got the error Saude is not a valid member of Model "Workspace.JellyM015".