Help with assigning a player to a special team

Hello, I’m trying to assign a certain player to a special team.

Here’s the team-assigning script that I used:

local SpecialPlayer = game.Teams.SpecialPlayer

game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "hctdev" then
		player.Team = SpecialPlayer
	else
		player.Team = Player
	end
end)

I also disabled the auto-assignable property for all the teams to prevent the player from being randomly assigned to any team.

When a player with the name “hctdev” joins the game, the script should place them in the “SpecialPlayer” team, however, the player ends up in a neutral team.

I also tried assigning using TeamColor

if player.Name == "hctdev" then
        player.TeamColor = BrickColor.new("White")

But it was to no avail.

Is there a way to fix this?

Typo?!
30-Chaaaaaaaars

1 Like

Rechecked the script, changed Team to Teams. Also capitalized the T in team, still didn’t work. Also checked the name of the name of the Teams folder which was named Teams, nothing wrong with that. Don’t think it’s a typo error. *Edited the code in original post

Both the username and display name

Just saw the post was solved. Sorry.

Turns out the place was bugged. Transferred script to another place and managed to get it to work👍

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.