Script inside serverscriptservice, no errors, it just doesn't do anything.
local replicatedstorage = game:GetService('ReplicatedStorage') local status = replicatedstorage:WaitForChild('InfoValue') function randomTeams(player) if status.Value == "Map Spawned, prepare to fight soon!" then local teamValue = game.ServerScriptService.MainScript.TeamValue.Value local teamBlue = game.ServerStorage.Blue:Clone() local teamRed = game.ServerStorage.Red:Clone() teamRed.Parent = game.Teams teamBlue.Parent = game.Teams if teamValue == 1 then player.TeamColor = BrickColor.new("Really red") teamValue = 2 elseif teamValue == 2 then player.TeamColor = BrickColor.new("Really blue") teamValue = 1 end end end randomTeams()
You fired "randomTeams" expecting a "player" parameter but not providing one. Also, you ran it expecting that each player would be looped through it, when in reality none are. I suggest removing the player parameter and adding a loop for every player. Also, when checking an Instance's value as a variable, don't include ".Value" in the variable declaration, it messes things up. Here, I'll show you:
local replicatedstorage = game:GetService('ReplicatedStorage') local status = replicatedstorage:WaitForChild('InfoValue') function randomTeams() if status.Value == "Map Spawned, prepare to fight soon!" then local teamValue = game.ServerScriptService.MainScript.TeamValue local teamBlue = game.ServerStorage.Blue:Clone() local teamRed = game.ServerStorage.Red:Clone() teamRed.Parent = game.Teams teamBlue.Parent = game.Teams for _,plr in pairs(game.Players:GetChildren()) do if teamValue.Value == 1 then plr.TeamColor = BrickColor.new("Really red") teamValue.Value = 2 else if teamValue.Value == 2 then plr.TeamColor = BrickColor.new("Really blue") teamValue.Value = 1 end end end end end randomTeams()
If this still doesn't work, just double check that on the team spawns, they aren't neutral or auto-assignable