Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I assign a certain player on a team?

I'm just barely getting into scripting and I was wondering on how I assign a certain player name a team when they join. Thanks.

-Jordi

1 answer

local turns
local random
local times = 8 -- Amount of times to randomize the counts

game.Players.PlayerAdded:connect(function(player)
    random = math.random(1, 2)
    while true do
        if random == 1 then
            turns = turns + 1
            if turns == times then
            player.Team = RED
            return
            end
        elseif random == 2 then
        turns = turns + 1
            if turns == times then
            player.Team = BLUE
            return
        end
    end
end
end)

PS. Didn't test this code!

Edit: Did fix!

This discussion is preserved as it was. New answers, comments, and votes are closed.