Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years 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 = Instance.new("Folder", Player) Leaderstats.Name = "leaderstats" local Currency = Instance.new("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?

0
Don't forget to click "view 25 more" kickoff127 103 — 3y
0
So know one? kickoff127 103 — 3y

Answer this question