I was making a table of classifications but something is failing I want it to be of levels but when they change the name it fails again. I need someone to help me, I leave some screenshots
here’s the script of the other problem.
local OrderedDataStore = game:GetService(“DataStoreService”):GetOrderedDataStore(“Saved”)
local Holder = script.Parent.Frame.ScrollingFrame
local CurrencyName = “Levels”
local Prefix = "Levels "
local List = 15
local RefreshingTime = 10
function Main ()
local Success, Error = pcall(function()
local Pages = OrderedDataStore:GetSortedAsync(false, List)
local Data = Pages:GetCurrentPage()
for pos, v in ipairs(Data)do
local PlayerName = tostring(v.key)
local Data = tostring(v.value)
local NewFrame = script.Frame:Clone()
NewFrame.PlayerPos.Text = pos .. ". " .. PlayerName
NewFrame.PlayerCurrency.Text = Prefix .. Data
NewFrame.Parent = Holder
end
end)
if not Success and Error then
error(Error)
end
end
while true do
for _, Player in pairs(game.Players:GetPlayers())do
local PlayerValue = Player.leaderstats[CurrencyName]
OrderedDataStore:SetAsync(Player.Name, PlayerValue.Value)
end
for _, v in pairs(Holder:GetChildren())do
if v.Name == "Frame" and v:IsA("Frame") then
v:Destroy()
end
end
Main()
wait(RefreshingTime)
Conent is not a function, in fact I don’t think it’s anything at all.
Secondly what on Earth are you doing with game.Parent ?
to run a function each time a player joins
do this instead :
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function()
--// code
end)
also you can’t connect an event to a non-existent function , you can’t connect it to an instance either (like leaderstats), that doesn’t make sense!