local DataStoreService = game:GetService("DataStoreService")
local moneyDataStore = DataStoreService:GetDataStore("Money")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Money"
money.Parent = leaderstats
money.Value = moneyDataStore:GetAsync(player.UserId) or 0
print(money.Value)
end)
game.Players.PlayerRemoving:Connect(function(plr)
print(plr.leaderstats.Money.Value)
moneyDataStore:SetAsync(plr.UserId, plr.leaderstats.Money.Value)
end)```
#DataStore not saving after user rejoins
1 messages · Page 1 of 1 (latest)
maybe bindtoclose()?
the whole server shuts down in roblox studio when u leave
unless your team testing
so thats why bindtoclose runs a few more moments before closing
yeah but make sure u check if its studio before running bindtoclose
no , it doesn't
try using pcalls bro
and make sure u got data store access permission in the game
well this basic one should pretty much work even if slight chance of failing
** You are now Level 17! **
p calls are safer but idk why this one is failing
maybe he has data store access off?
its either he hasnt enabled access or bindtoclose() if he is using roblox studio to test his stuff that is
u dont need bind to close function 🥀
its good to have bindtoclose() for real games just incase the servers crash or shutdown
he is learning
well if u leave, the servers shut down too inside roblox studio since it is a solo play
the player removing works for me everytime in studio , idk why u think thats the case . I might be wrong or you 🥀
** You are now Level 1! **
use profilestore
GIVE HIM A SIMPLE SOLUTION
profilestore is simple lmao
he hasnt learnt datastores yet
ur dumb if u cant understand it
basics first
does he even know abt them thats the thing
profilestore easier than regular datastores 💀
he learning atm
convince him to learn profilestore
no
i still dont understand normal datastore methods so i just use profileservice