PipeSader
(PipeSader)
February 19, 2021, 3:09pm
#1
Hello, I need to script the team guest as a neutral team for players by default when joining the game, what is wrong with my script? nothing happens, no output errors
Script:
local function guestTeamJoin()
local guestTeam = Instance.new("Team")
guestTeam.Name = "Guest"
guestTeam.TeamColor = BrickColor.new("Really red")
guestTeam.AutoAssignable = true
local guestSpawnLocation = Instance.new("SpawnLocation")
guestSpawnLocation.BrickColor = BrickColor.new("Really red")
guestSpawnLocation.Color = Color3.fromRGB(255, 0, 0)
guestSpawnLocation.Neutral = true
end
game.Players.PlayerAdded:Connect(guestTeamJoin)
changeno
(changeno)
February 19, 2021, 3:14pm
#2
Is this a ServerScript or a LocalScript?
changeno
(changeno)
February 19, 2021, 3:15pm
#3
Found it. You didnt set the team’s parent to the team service.
PipeSader
(PipeSader)
February 19, 2021, 3:16pm
#4
PipeSader:
local function guestTeamJoin()
local guestTeam = Instance.new("Team")
guestTeam.Name = "Guest"
guestTeam.TeamColor = BrickColor.new("Really red")
guestTeam.AutoAssignable = true
local guestSpawnLocation = Instance.new("SpawnLocation")
guestSpawnLocation.BrickColor = BrickColor.new("Really red")
guestSpawnLocation.Color = Color3.fromRGB(255, 0, 0)
guestSpawnLocation.Neutral = true
end
game.Players.PlayerAdded:Connect(guestTeamJoin)
it’s a server script in server script service:
and there are no teams
changeno
(changeno)
February 19, 2021, 3:17pm
#5
Try doing what I said above. Then tell me if it works or not.
PipeSader
(PipeSader)
February 19, 2021, 3:18pm
#6
Oh how could i parent it to the the team service?
changeno
(changeno)
February 19, 2021, 3:19pm
#7
Change this line:
local guestTeam = Instance.new("Team")
To this:
local guestTeam = Instance.new("Team", game:GetService("Teams"))
1 Like
PipeSader
(PipeSader)
February 19, 2021, 3:21pm
#9
Oh I already did! now it works thanks you a lot
local function guestTeamJoin()
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
changeno
(changeno)
February 19, 2021, 3:21pm
#10
No problem Can you mark it as solution?
PipeSader
(PipeSader)
February 19, 2021, 3:22pm
#11
Hey, one last question… how to i set Guest Team as Neutral in the tab?
I need guest to be the neutral team and not neutral
changeno
(changeno)
February 19, 2021, 3:24pm
#12
Move the player to the team when they join. If the Neutral team is empty, It will delete itself.
1 Like
PipeSader
(PipeSader)
February 19, 2021, 3:24pm
#13
How could I do that? I’m not sure, sorry for the inconvenience
changeno
(changeno)
February 19, 2021, 3:27pm
#14
Change your script to this:
local function guestTeamJoin(player)
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
game.Players.PlayerAdded:Connect(guestTeamJoin(player))
changeno
(changeno)
February 19, 2021, 3:32pm
#16
I’m on mobile so I can’t make sure it works, sorry. Give me some moment.
legs_v
(legs)
February 19, 2021, 3:32pm
#17
Do
game.Players.PlayerAdded:Connect(guestTeamJoin)
PipeSader
(PipeSader)
February 19, 2021, 3:35pm
#18
how to i set Guest Team as Neutral in the tab?
I need guest to be the neutral team and not neutral
script:
local function guestTeamJoin(plr)
local guestTeam = Instance.new("Team")
guestTeam.Parent = game:GetService("Teams")
guestTeam.Name = "Guest"
guestTeam.TeamColor = BrickColor.new("Really red")
guestTeam.AutoAssignable = true
plr.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
game.Players.PlayerAdded:Connect(guestTeamJoin)
legs_v
(legs)
February 19, 2021, 3:35pm
#19
Also creating a new team everytime someone joins, is that really what you want to do?
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
legs_v
(legs)
February 19, 2021, 3:36pm
#20
Set guestSpawnLocation.Neutral
to false