I followed a tutorial from youtube and i was wondering why the script isn't working, i got no error and the tutorial is recent, please help, thanks.
local ds = game:GetService("DataStoreService")
local killsstat = ds:GetDataStore("SaveData")
local resettime = 10
while wait(1) do
resettime = resettime - 1
script.Parent.Parent.ResetTime.Text = "Resetting in : "..resettime.." seconds."
if resettime == 0 then
resettime = 10
for i, plr in pairs(game.Players:GetPlayers()) do
killsstat:GetAsync(plr.UserId, plr.leaderstats.Kills.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 = killsstat:GetSortedAsync(false, 15)
local killspage = data:GetCurrentPage()
for rankinLB, dataStored in ipairs(killspage) do
local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
local kills = dataStored.Value
local layout = script.Layout:Clone()
layout.Name = name.." Leaderboard"
layout.PlayerName.Text = name
layout.Rank.Text = "#"..rankinLB
layout.Kills.Text = kills
layout.Parent = script.Parent
end
end)
end
end
