Help with team script error

Any errors, or any reason on your behalf why its not working

He just forgot to call the function when a player joins. Try this:

local Teams = game:GetService("Teams")
local function guestTeamJoin(player)
    if not Teams:FindFirstChild("Guest") then
	  local guestTeam = Instance.new("Team")
	  guestTeam.Parent = game:GetService("Teams")
	  guestTeam.Name = "Guest"
	  guestTeam.TeamColor = BrickColor.new("Really red")
	  guestTeam.AutoAssignable = true
      player.TeamColor = BrickColor.new("Really red")

	  local guestSpawnLocation = Instance.new("SpawnLocation")
	  guestSpawnLocation.Parent = game:GetService("Teams")
	  guestSpawnLocation.BrickColor = BrickColor.new("Really red")
	  guestSpawnLocation.Color = Color3.fromRGB(255, 0, 0)
	  guestSpawnLocation.Neutral = true
    end
end

game.Players.PlayerAdded:Connect(guestTeamJoin)
1 Like

do I need to test this from the roblox player? it keeps appearing to me like this

i did it and still neutral

local Teams = game:GetService("Teams")
local function guestTeamJoin(player)
    if not Teams:FindFirstChild("Guest") then
	  local guestTeam = Instance.new("Team")
	  guestTeam.Parent = game:GetService("Teams")
	  guestTeam.Name = "Guest"
	  guestTeam.TeamColor = BrickColor.new("Really red")
	  guestTeam.AutoAssignable = true

	  local guestSpawnLocation = Instance.new("SpawnLocation")
	  guestSpawnLocation.Parent = game:GetService("Teams")
	  guestSpawnLocation.BrickColor = BrickColor.new("Really red")
	  guestSpawnLocation.Color = Color3.fromRGB(255, 0, 0)
	  guestSpawnLocation.Neutral = true
    end
    player.TeamColor = BrickColor.new("Really red")
end

game.Players.PlayerAdded:Connect(guestTeamJoin)

change the players team outside the if statement

1 Like

You could probably create the team before player’s even join, so you don’t even need the playeraddedfunction. Then it will auto assign them when they join. Try this:

  local guestTeam = Instance.new("Team")
  guestTeam.Parent = game:GetService("Teams")
  guestTeam.Name = "Guest"
  guestTeam.TeamColor = BrickColor.new("Really red")
  guestTeam.AutoAssignable = true

local guestSpawnLocation = Instance.new("SpawnLocation")
guestSpawnLocation.Parent = game:GetService("Teams")
 guestSpawnLocation.BrickColor = BrickColor.new("Really red")
  guestSpawnLocation.Color = Color3.fromRGB(255, 0, 0)
guestSpawnLocation.Neutral = true

Uh it still doesn’t work … :frowning: I need the player’s team name and color to be the one I created by default

local Teams = game:GetService("Teams")

local guestTeam = Instance.new("Team",Teams)
guestTeam.Name = "Guest"
guestTeam.TeamColor = BrickColor.new("Really red")
guestTeam.AutoAssignable = false

local guestSpawn = Instance.new("SpawnLocation",workspace)
guestSpawn.TeamColor = guestTeam.TeamColor
guestSpawn.BrickColor = BrickColor.new("Really red")

game:GetService("Players").PlayerAdded:Connect(function(player)
    player.Team = guestTeam
end)

The latter is in case you want to add more teams.
Change “guestTeam” to the team you want.

1 Like

Thank you! I was missing that of parentar to workspace haha :smiley:

1 Like