I am trying to make an auto team script that teams a player on a team if they are the group and if they are not they get teamed to the other team.
My attempt at the script:
game.Players.PlayerAdded:connect(function(player) if player:GroupId = 7094704 player.Team = "Irish Defence Forces" else player.TeamColor = "Enemies" end)
Maybe try
game.Players.PlayerAdded:connect(function(player) if player:GroupId = 7094704 player.Team = game.Teams["Irish Defence Forces"] else player.Team = game.Teams.Enemies end) end
Hope this works! Sorry if it doesn't :(.
Roblox has a function to determine this. Define your player as a variable.
game.Players.PlayerAdded:Connect(function(plr) local ID = 7094704 if plr:IsInGroup(ID) then plr.Team = game:WaitForChild("Teams"):WaitForChild("Irish Defense Force") else plr.team = game:WaitForChild("Teams"):WaitForChild("Enemies") end end
This should work.