Hey, i've attempted at a script to create two teams then randomly assign players to teams. Currently i tried to make it so that it creates a NumberValue in every player then randomly generates a number between 1 and 2 and if its 1 your on team A if 2 team B. Heres my script.
P = game.Players:GetPlayers()
E = Instance.new("NumberValue")
E.Parent = game.Players:GetPlayers()
E.Value = math.random(1,2)
if E.Value == 1 then
E.Parent.Parent.Team = game.Teams.Guards
end
if E.Value == 2 then
E.Parent.Parent.Team = game.Teams.Theives
end
BTW this is the section of the script that doesnt work, creating the teams works fine. Returns error "Expected Object got Table" probably caused by me trying to put a Instance in a table, but im not sure how to fix this.
Thanks! -Sir

1 comment
Hold on I got the answer, give me a second