Here's the script:
local pes = game.Teams.PES:GetPlayers local fifa = Teams.FIFA:GetPlayers local myArray = {fifa, pes} #myArray math.random(x) myArray[x] myArray[math.random(#myArray)] end)
I'm basically trying to get team captains for a soccer game. The 2nd 'local' has an error for some reason and I can't seem to figure out why.
wookey12's answer is incorrect. I'll show you the method to get a random player from each team here... this script chooses a random captain for each team
local PESmembers = game.Teams:WaitForChild("PES"):GetPlayers() local FIFAmembers = game.Teams:WaitForChild("FIFA"):GetPlayers() local PEScaptain = PESmembers[math.random(#PESmembers)] local FIFAcaptain = FIFAmembers[math.random(#FIFAmembers)]
in the second variable (or local as you called it) you need to add "game" right before "Teams"
local pes = game.Teams.PES:GetPlayers local fifa = game.Teams.FIFA:GetPlayers local myArray = {fifa, pes}