#How to get more scripts in leaderboard?

13 messages · Page 1 of 1 (latest)

hallow fractal
#

did you add a new Instance (NumberValue/IntValue) or just change the name?

#
game.Players.PlayerAdded:Connect(function(plr)

    local folder = Instance.new("Folder")
    folder.Parent = plr
    folder.Name = "leaderstats"



    local money = Instance.new("NumberValue")
    money.Parent = folder
    money.Name = "Money"

    local Time= Instance.new("NumberValue")
    Time.Parent = folder
    Time.Name = "Time"
end)
marble basalt
# hallow fractal did you add a new Instance (NumberValue/IntValue) or just change the name?

I dont know. I took the scripts from youtube tutorials they are not made by me. At first there was cash in leaderstats and it was working. After i added the time script my shop is not working. Cash gui is also not working and i dont see the cash in the leaderstats. I just want to somehow add the cash in the leaderstats with the time script also. Im like super new in roblox scripting 😄

wraith stream
#

studio** You are now Level 1! **studio

hallow fractal
#

just use one script like the one ive sent

marble basalt
hallow fractal
marble basalt
#

And then it resets? 😄

#

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

game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr

local aliveTime = Instance.new("IntValue")
aliveTime.Name = "Time Alive"
aliveTime.Parent = leaderstats

local bestTime = Instance.new("IntValue")
bestTime.Name = "Best Time"
bestTime.Parent = leaderstats

local data

local success, message = pcall(function()
    data = DataStore:GetAsync(plr.UserId .. "-Data")
end)

if success then
    if data then
        bestTime.Value = data
    end
else
    warn(message)
    plr:Kick("Error while retrieving your data.")
end

end)

game.Players.PlayerRemoving:Connect(function(plr)
local data = plr.leaderstats["Best Time"].Value

local success, message = pcall(function()
    DataStore:SetAsync(plr.UserId .. "-Data", data)
end)

if not success then
    warn(message)
end

end)

#

This is the time script

#

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local cash = Instance.new("NumberValue")
cash.Name = "Cash"
cash.Value = 0
cash.Parent = leaderstats
#

And this is the Cash script