#Datastore stopped working
12 messages · Page 1 of 1 (latest)
here bro
local DataStoreService = game:GetService("DataStoreService")
local leaderstatsData = DataStoreService:GetDataStore("LeaderstatsData")
game.Players.PlayerAdded:Connect(function(player)
local playerData = leaderstatsData:GetAsync(player.UserId)
if not playerData then
playerData = {
Clicks = 0,
Coins = 0
}
leaderstatsData:SetAsync(player.UserId, playerData)
end
player.leaderstats.Clicks.Value = playerData.Clicks
player.leaderstats.Coins.Value = playerData.Coins
end)
game.Players.PlayerRemoving:Connect(function(player)
local playerData = {
Clicks = player.leaderstats.Clicks.Value,
Coins = player.leaderstats.Coins.Value
}
leaderstatsData:SetAsync(player.UserId, playerData)
end)
fixed it
your using the playeradded and removing function too much fit it into 1 added and 1 removing
this should work
worked for me atleast
@toxic field
** You are now Level 3! **