Attempt to index nil with Stats

can I get an example of how I should do that?


local luckManager = {}

local luckDictionary = {}

luckManager.get = function(player)
  local playerLuck = luckDictionary[player.UserId]
  return playerLuck
end

game.Players.PlayerAdded:Connect(function(plr)
  luckDictionary[plr] = 0
)


return luckManager

In your module just require this. It’s a singleton, which means the data will be unique.

how do I do that it just returns a bunch of errors

Sorry, this isn’t code you can use. It’s only a rough guide, of what you could do. You should store every player in a table, with their luck being the value. Then you can just lookup a player, and get their luck