So I have a variable that is a random player from a team called 'Playing'
local randomteamplr = game.GetService("Teams").Playing:GetPlayers()[math.random(1, #game.GetService("Teams").Playing:GetPlayers())] --this is all on the same line
then I wanted to make a function that would change that variables value to another random player from that team. (I don't care if it has a chance to be the same one.)
local function pickPlayer() randomteamplr = game.GetService("Teams").Playing:GetPlayers()[math.random(1, #game:GetService("Teams").Playing:GetPlayers())] -- everything in this function is also all on the same line end
The script says there's no error but when I play I get this error:
invalid argument #2 to 'random' (interval is empty)
Not sure what I'm doing wrong?