If someone click the GUI button, I want to create citizen team and make that player to be in citizen team. I successed for making a Citizen team but I failed that player to be in the citizen team. How can I fix it?
script.Parent.MouseButton1Click:Connect(function(player)
local Team = game:GetService("Teams")
local Citizen = Instance.new("Team", Team)
Citizen.TeamColor = BrickColor.new("New Yeller")
Citizen.AutoAssignable = false
Citizen.Name = "Citizen"
player.TeamColor = "New Yeller"
game.StarterGui.ScreenGui:Remove()
end)
Hello
Firstly, you need to better indent your code, its very hard to diagnose any problem with it being like that.
However, if there is no syntax error in your code, the issue might be with the Neutral team player setting. If a player has there team setting set as neutral, they will not change team, even with a change of TeamColor. You can see the documentation for this here
You can disable this setting in the player by simply running:
player.Neutral = false
Hope this helps, Tweakified