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)