local module = {}
local DataStore = game:GetService("DataStoreService"):GetDataStore("M12341123231")
local StarterPounds = 0
game.Players.PlayerAdded:connect(function(player) local Stats = Instance.new('Folder', player) Stats.Name = "Stats"
local Pounds = Instance.new('NumberValue', player) Pounds.Name = "Pounds" Pounds.Value = StarterPounds Pounds.Parent = Stats local SavedPounds = DataStore.GetAsync(player.UserId..'-Pounds') if SavedPounds == nil then Pounds.Value = SavedPounds end
end)
game.Players.PlayerRemoving:connect(function(player) local id = player.UserId local PoundsValue = player.Stats.Pounds.Value DataStore:SetAsync(id..'-Pounds', PoundsValue) end) return module
Whenever I change the first argument I get UserId isn't a valid member of Player.~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~
You are using the following:
DataStore.GetAsync()
You should be using the following:
DataStore:GetAsync()
GetAsync is a function, not a property, so it must be called upon with a colon rather than a period.