I just want a variable that defines all players
local e = for _,v in pairs(game.Players:GetPlayers()) do --this does not work
You simply need to use the GetPlayer
function of Players
, which returns a table/list of all descendants of Players
that are player objects. All you'd have to do then is assign a variable to the function.
players = game:GetService("Players"):GetPlayers()
Not sure what you mean by a variable that defines all players, but I'm pretty sure this will work, if you want to just get all players.
local players = game:GetService("Players"):GetPlayers()