Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When Team change it creates neutral team??

I am trying to make a teamchanger gui issue is everytime I try changing teams it creates a new team (Neutral) and puts me in it. I already have one team that is autoassignable which is citizens then I got 2 teams one is prisoner and the other cop which has autoassignable off.

Local script in button

script.Parent.MouseButton1Click:Connect(function()

	local team = script.Parent.Text

	game.ReplicatedStorage.ChangedTeam:FireServer(team.Value)

end)


Script in Severscriptservice

game.ReplicatedStorage.ChangedTeam.OnServerEvent:Connect(function(player, team)



	player.Team = team



	player:LoadCharacter()



end)


2 answers

✓ Accepted answer

The “Neutral” Team being created means that there is a player that hasn't been assigned to a team, which means that your script simply isn't updating the team of the player is in correctly.

This is likely due to what the other answer already mentioned:

It should be :FireServer(team) and not :FireServer(team.Value) as you have already declared team as the .Text property of an instance.

Edit: I recommend trying to change player.Team = team to player.Team = game.Teams:FindFirstChild(team), since usually the Team property of a Player takes a team-instance, not a string.

3 comments

0

It stopped making the neutral team but it completely doesn't work and comes up with an error: cannot assign team something like that

0

That issue is caused by the server script listening for the remote. Check my edit.

0

Thank you so much it works now!!

you don't need to put value at the end. game.ReplicatedStorage.ChangedTeam:FireServer(team)

2 comments

0

It stopped making the neutral team but it completely doesn't work and comes up with an error: cannot assign team

0

hmm, thats odd.

This discussion is preserved as it was. New answers, comments, and votes are closed.