Hello! I'm making a model with the robbable bank of alvinblox because many people want it with a script that makes de money save so I'm trying to do it, but as soon as I tested got this error: getasync is not a valid member of datastoreservice. And of course, the leaderboard doesn't show. If someone can fix it, there's the script:
local ds = game:GetService("DataStoreService")
game.Players.PlayerAdded:Connect(function(player)
local data = ds:GetAsync("player_" .. player.UserId) or 0
local ls = Instance.new("Folder",player)
ls.Name = "leaderstats"
local money = Instance.new("IntValue",ls)
money.Name = "Money"
money.Value = data
local cc = Instance.new("IntValue",player)
cc.Name = "CashCollected"
local robbing = Instance.new("BoolValue",player)
robbing.Name = "Robbing"
robbing.Value = false
player.CharacterAdded:Connect(function(char)
player.Robbing.Value = false
player.CashCollected.Value = 0
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
ds:SetAsync("player_" .. player.UserId, player:WaitForChild("leaderstats").Money.Value)
end)

2 comments
http://robloxdev.com/api-reference/function/DataStoreService/GetDataStore
NEVER LEARN HOW TO SCRIPT FROM ALVINBLOX!