Log in to vote

Why does the death counter work but the autosave does not?

Asked by 4 months ago
Edited 4 months ago

So I wanted to make a death leaderboard with autosave for me game, so I made this script:(Someone else's script)

--This script was made by ROBLOXSCRIPT ISEASY local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("Deaths") -- Change this with a random name. game.Players.PlayerAdded:Connect(function(Player) local Leaderstats ="Folder", Player) Leaderstats.Name = "leaderstats" local Currency ="IntValue", Leaderstats) Currency.Name = "Deaths" -- Change this with your currency name. Currency.Value = 0 local humanoid = char:FindFirstChild("Humanoid") humanoid.Died:Connect(function() Deaths.Value = Deaths.Value + 1 local Data = DataStore:GetAsync(Player.UserId) if Data then Currency.Value = Data end end) game.Players.PlayerRemoving:Connect(function(Player) DataStore:SetAsync(Player.UserId, Player.leaderstats.Deaths.Value) end)

The death counter works, but the autosave does not. Will you help me?

Don't forget to click "view 25 more" kickoff127 15 — 4mo
So know one? kickoff127 15 — 4mo

Answer this question