I've tried this a couple different ways and can not seem to get it to work. The code I have is short, but let me explain. What I am trying to write is a script that will grab all the players in the game, and choose one randomly. Everytime I try to print or run to test my script it throws an error saying ' unable to index local i, a number value' am i using the random number wrong? Let me know if you guys can help, thanks!
for i,v in pairs(game.Players:GetChildren()) do
local ranI = math.random(1,i)
local ChosenPlayer = i[ranI]
end
