I'm pretty sure this script is outdated, but here it is.(ServerScript in ServerScriptService)
local DS = game:GetService("DataStoreService")
local VertigoVal = DS:GetDataStore("VertigoVal")
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder",plr)
leaderstats.Name = "leaderstats"
local Vertigo = Instance.new("IntValue",leaderstats)
Vertigo.Name = "Vertigo"
Vertigo.Value = 100
game.Players.PlayerRemoving:Connect(function(plr)
VertigoVal:SetAsync(plr.UserId,Vertigo.Value)
end)
Vertigo.Value = VertigoVal:GetAsync(plr.UserId) or 100
while true do
wait(30)
VertigoVal:SetAsync(plr.UserId,Vertigo.Value)
end
end)
When I test the game, I manually set my Vertigo (cash) to a random number, not 100. But when I re-test, the value doesn't save. I turned on API services and HTTP services.
What on earth is going on? Is it because it's outdated?
Please help!

7 comments
Oh and yeah, I forgot to tell you That THERES no wait time!
No.. It doesn't work. How could my game be broken?
Try the script and Turn API services on
I did.
Is it in ServerScriptService and the script type is Script?
Yes.
Hmm...