Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Fix?|How do I make my game randomize the teams and make it two teams?

Asked by 4 years ago
Edited 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).





team = game.Teams.NHL while true do~~~~~~~~~~~~~~~~~


wait(5)~~~~~~~~~~~~~~~~~

teamstochoosefrom = math.random(1,5) if teamstochoosefrom == 1 then game.teams.NHL = team.new('Carolina Hurricanes') end~~~~~~~~~~~~~~~~~


if teamstochoosefrom == 2 then game.teams.NHL = team.new('Columbus Blue Jackets') end~~~~~~~~~~~~~~~~~

if teamstochoosefrom == 3 then game.teams.NHL = team.new('New York Rangers') end~~~~~~~~~~~~~~~~~


if teamstochoosefrom == 4 then game.teams.NHL = team.new('New Jersey Devils') end~~~~~~~~~~~~~~~~~

if teamstochoosefrom == 5 then game.teams.NHL = team.new('New York Islanders') end~~~~~~~~~~~~~~~~~


end

~~~~~~~~~~~~~~~~~

0
You can't write HTML in the text box. Just type all your code and select it then click the code block button. namespace25 594 — 4y

1 answer

Log in to vote
0
Answered by
EthanFins 104
4 years ago

If its team randomizing you're after then you will have to make a script in your game loop that finds every player and uses a boolen to make the last player still have a team even if the numbers not even! here's the code I would use:

-- Put this in your main Game Loop / or not XD

local NewJerseyDevilsORNOT = false
for i,player in pairs(game.Players:GetPlayers()) do
    if NewJerseyDevilsORNOT == true then
        -- Replace your New Jersey Devil team here <--
        NewJerseyDevilsORNOT = false
    else
        -- Replace your Columbus Blue Jackets team here <--
        NewJerseyDevilsORNOT = true
    end 
end

I Hope this Helped!

Ad

Answer this question