Can someone help me how can I add the kill leaderboard next to cash?
here the script:
local datastore = game:GetService(“DataStoreService”)
local ds = datastore:GetDataStore(“CashSaveSystem”)
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local Cash = Instance.new("IntValue")
Cash.Name = "Cash"
Cash.Value = 0
Cash.Parent = stats
stats.Parent = newPlayer
while true do
wait(4)
Cash.Value = Cash.Value + 16
game.ReplicatedStorage.EconomyHandlers.LostMoney:InvokeClient(newPlayer,“GAIN”,16)
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
blokav
(blokav)
2
You can have more than one value object inside the leaderstats container.
local datastore = game:GetService("DataStoreService")
local ds = datastore:GetDataStore("CashSaveSystem")
function onPlayerEntered(newPlayer)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
local Cash = Instance.new("IntValue")
Cash.Name = "Cash"
Cash.Value = 0
local Kill = Instance.new("IntValue")
Kill.Name = "Kills"
Kill.Value = 0
Cash.Parent = stats
stats.Parent = newPlayer
while true do
wait(4)
Cash.Value = Cash.Value + 16
game.ReplicatedStorage.EconomyHandlers.LostMoney:InvokeClient(newPlayer,“GAIN”,16)
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
3 Likes