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

Why does only cash show up on my leaderboard?

Asked by 3 years ago
Edited by youtubemasterWOW 3 years ago

So i copied a youtube tutorial from ripperoni on how to make a data saving leaderboard, and it worked for one of my intvalues "cash". I didn't know how to make a second stat so i pretty much just coped the cash one and made a 2nd data store called studsaving system and changed the name of cash to studs. Studs doesnt appear but cash works fine. Please help its 12am in the morning.

heres my code im sorry its not on each line idk how

local DataStore = game:GetService("DataStoreService")

local ds = DataStore:GetDataStore("CashSaveSystem")

 local ds2 = DataStore:GetDataStore("StudsSaveSystem")

game.Players.PlayerAdded:connect(function(player)

 local leader = Instance.new("Folder",player)

leader.Name = "leaderstats"

    local Cash = Instance.new("IntValue",leader)


Cash.Name = "Cash"


Cash.Value = ds:GetAsync(player.UserId) or 0


 ds:SetAsync(player.UserId, Cash.Value)


 Cash.Changed:connect(function()


ds:SetAsync(player.UserId, Cash.Value)



local studs = Instance.new("IntValue",leader)


studs.Name = "studs"

 studs.Value = ds2:GetAsync(player.UserId) or 0

 ds2:SetAsync(player.UserId, studs.Value)

 studs.Changed:connect(function()

  ds2:SetAsync(player.UserId, studs.Value)

    end)

end)


game.Players.PlayerRemoving:connect(function(player)

 ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)

 ds2:SetAsync(player.UserId, player.leaderstats.studs.Value)

    end)

    end)    
0
Can you fix your code block? SteamG00B 1633 — 3y
0
im not sure true_200ping 2 — 3y
0
Can you fix the block of code? iivSnooxy 248 — 3y

Answer this question