Script not working in game but works on other game

I have a Global Leaderboard that works in this Game but it doesn’t work on this Game.
(Both game are mine)
I copy and pasted it since it basically do the same thing but it doesn’t work.

local ds = game:GetService("DataStoreService")

local coinsODS = ds:GetOrderedDataStore("test")

local timeUntilReset = 10

while wait(1) do

timeUntilReset = timeUntilReset - 1

if timeUntilReset == 0 then

timeUntilReset = 10

for i, plr in pairs(game.Players:GetPlayers()) do

coinsODS:SetAsync(plr.UserId, plr.leaderstats.Wins.Value)

end

for i, leaderboardRank in pairs(script.Parent:GetChildren()) do

if leaderboardRank.ClassName == "Frame" then

leaderboardRank:Destroy()

end

end

local success, errorMsg = pcall(function()

local data = coinsODS:GetSortedAsync(false, 10)

local coinsPage = data:GetCurrentPage()

for rankInLB, dataStored in ipairs(coinsPage) do

local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))

local coins = dataStored.value

local template = script.template:Clone()

template.Name = name .. "Leaderboard"

template.username.Text = name

template.rank.Text = "#" .. rankInLB

template.wins.Text = coins

template.Visible = true

template.Parent = script.Parent

end

end)

end

end

The “Obby madness” game leaderboard works fine but the “Boulder” game doesn’t load the leaderboard, it only shows your name when your wins changed, it only show my name(itzMehPlayin). Any help will be appreciated.

Did you make sure that you have these 2 things turned on in game settings?
on

1 Like

Does the board work now? [character limit]

I just turned it on right now (Http Request) and tested it but it doesn’t load the leaderboard when I joined

You also have to (most important thing) turn on the API services because you are using a Datastore which is an API service)

It’s already turned on because that’s the only thing I remember that is important when using datastore. but yeah still doesn’t work

recommend you to use this board instead:

Im not quite sure why your board is working in your other game. Maybe try renaming the datastore? .-.

1 Like

Thank you for helping! Changing the datastore name fixed the problem

1 Like