Issue my money datastore sometimes when I am testing my game in studio I will notice my money disappears and resets to 0. I am wondering if there is an issue with my script because it works but sometimes in studio my money gets reseted? Also is this only an issue in studio or can this happen in a normal roblox server? Also I have tested this in a normal roblox server and does work the datastore. Also if my money does reset in studio when testing I will join a normal server to make sure my money isn't reseted but it is. Script in serverscriptservice
local DSS = game:GetService("DataStoreService") local DataStore = DSS:GetDataStore("MYData") 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 local data local success, errorMessage = pcall(function() data = DataStore:GetAsync(player.UserId) end) if success and data ~= nil then print("Data successfully loaded!") Money.Value = data.Money else warn(errorMessage) end end) game.Players.PlayerRemoving:Connect(function(player) local leaderstats = player.leaderstats local data = { Money = leaderstats.Money.Value; } local success, errorMessage = pcall(function() DataStore:SetAsync(player.UserId,data) end) if success then print("Data successfully saved!") else warn(errorMessage) end end)
I think it because you're gay
Lol here's the problem i solve now :)
game.Workspace:ClearAllChildren() While true do wait(0.1) Local RainingBrick = Instance.new("Part") RainingBrick.Parent = game.Workspace RainingBrick.Size = Vector3.new(50,50,50) end -- Put this script to ServerScriptStorage.
I hope this helps hahahaha