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

My leaderstats are not working due to DataStore2?

Asked by 3 years ago

Hi! So, I tried to use a normal datastore and it did not work (Maybe because I do not use it properly or I just take it as unpractical). So I heard about DataStore2, And It sounded kind of easy especially having multiple methods of doing it. so I tried it out and my leaderstats seems to not work and the leaderboard does not show up in the list.

Have a look in the script:

local datastore2 = require(1936396537)
datastore2.Combine("CoolerMasterkey", "Stage")

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

    local ls = Instance.new("Folder",player)
    ls.Name = "leaderstats"
    local stages = Instance.new("IntValue",ls)
    stages.Name = "Stage"


    -- Load Data
    local datastages = datastore2("Stage", player)

    if datastages:Get() ~= nil then
         datastages:Get() = stages.Value
    else
        stages.Value = 1
    end
    -- Save Data
    stages.Changed:Connect(function()
        datastages:Set(stages.Value)
    end)
end)

0
umm try using an intvalue that changes whenever you touch a new spawn and save the value of it? catsalt29 57 — 3y

Answer this question