Issues with changing a leaderstats value to a ProfileService stored value

Hello there!
So, basically im trying to learn how to properly use ProfileService, but i have run into an issue here. Basically i just copy-pasted the example script given in the ProfileService topic, i only changed some of the names, and the printings, and put a

return Profiles

at the end. (Profiles is the table which contains the profiles lol).
Then i created a script and started making some leaderstats and made the “Money” Value be = to the value of the profile’s money data:

local Profiles = require(game.ServerScriptService.EpikProfileManager)

local leaderstats ="Folder")
leaderstats.Parent = player
leaderstats.Name = "leaderstats"

local Money ="IntValue")
Money.Parent = leaderstats
Money.Name = "Money"
Money.Value = Profiles[player].Data.Money --This is the error line. Tried to index nil with Data?

For some strange reason EVERYTHING works perfectly except from the part where i state the value of the Money, when i test it the output says: Tried to index nil with Data. Altough when i write it the game already detects there is something called Data and also something called Money, so it’s not a typo.

Yeah i’m probably just ignoring something important but i would like to understand why does this happen. :skull:

1 Like