Ad
Log in to vote
0

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 = 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 15 — 4mo
0
So know one? kickoff127 15 — 4mo

Answer this question