Hi, I wanted to ask what it means when there's a hashtag right next to a name of a variable like this example:
local players = game.Players:GetChildren() local playerPositions = {} if #Players then --what does this mean for _, Player in pairs(players) do table.insert(playerPositions, Player.Name) end end
The # if used before a table will returns the length of the table. This can be used in many cases as I listed a couple below.
local table = {1, 1, 1} print(#table) -- Expected output 3
local loadedPlrs = {} -- This really wouldn't be necessary just an example for _, plr in pairs(game.Players:GetPlayers()) do table.insert(loadedPlrs, plr) print(#loadedPlrs .. " Players loaded!") end
In your case it looks like it checks if any players exist before running that code.