My datastores got wiped basically

for some reason my datastore stopped working and it wiped out everything. All I did before this happened was just a ATM that when you triggered a prompt it would give you 500 Cash. And the first time it happened it said 403 forbidden or something. and now sometimes it wont save and will not give me an error when it doesnt save

Heres the script:

local players = game:GetService("Players")
local Datastore = game:GetService("DataStoreService")
local MoneyDatastore = Datastore:GetDataStore("MoneyDatastore")

players.PlayerAdded:Connect(function(plr)
	local money = Instance.new("IntValue")
	money.Name = "Cash"
	money.Parent = plr
	
	
	local data
	local success, failure = pcall(function()
		data = MoneyDatastore:GetAsync(plr.UserId.."-cash")
	end)
	
	if success then
		money.Value = data
	else
		warn("Something went wrong!; ".. failure)
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	local success, failure = pcall(function()
		MoneyDatastore:SetAsync(plr.UserId.."-cash", plr.Cash.Value)
	end)
	
	if success then
	else
		warn("something went wrong while trying to save!"..failure)
	end
end)

If you are testing in studio data stores have a notorious problem not saving on exit. Here’s a community tutorial on Data stores, look for :BindToClose. You have to enable data stores and that’s probably what the error 403 was.

1 Like