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

Needs help to create two leader stats value?

Asked by 5 years ago
Edited 5 years ago

Needs help to crate two leader stats value for example: Stage value and Points Value? my script just showing Stage Value.I hope to edit my script because I am not good at English: Note: this script auto saving players data

local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("StageSaveSystem")

game.Players.PlayerAdded:connect(function(player)
 local leader = Instance.new("Folder",player)
 leader.Name = "leaderstats"
 local Stage = Instance.new("IntValue",leader)
 Stage.Name = "Stage"
 Stage.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, Stage.Value)
 Stage.Changed:connect(function()
  ds:SetAsync(player.UserId, Stage.Value)
 end)
end)


game.Players.PlayerRemoving:connect(function(player)
 ds:SetAsync(player.UserId, player.leaderstats.Stage.Value)
end)
0
If you want it to actually save the amount, I would remove the or 0 in line 09. I did that and it worked like a charm for me. If you want to make it save 2 different points systems, I suggest you split the script into 2 parts. Top one being for making the leaderboard stats, and the second part, below, is for saving the stats. You can easily find how to make multiple Datasaves on youtube. superawesome113 112 — 5y
0
can you give me ready 2 value script ... plz . Cristials 29 — 5y

1 answer

Log in to vote
0
Answered by
Cyrakohl 108
5 years ago

What you can do Is copy line 7 and 8 and change there names to points.

Ad

Answer this question