local Key = workspace._DataStoreKey
local DS_Wins = “ds_wins”… Key.Value
local DS_Spree = “ds_spree”… Key.Value
local DS_Other = “ds_other”… Key.Value
local Players = game.Players
local Gui = Part.SurfaceGui
local List = Gui.ScrollingFrame
local Page = Gui.Page
local ReplicatedStorage = game.ReplicatedStorage
local function LoadPage(Player)
local Bust = ReplicatedStorage.LocalBoardRemotes.GetBust:InvokeServer(Player.UserId)
Page.ImageLabel.Image = Bust
--local SavedWins = DS_Wins:GetAsync(Player.UserId)
local SavedWins = ReplicatedStorage.LocalBoardRemotes.GetOrdered:InvokeServer(DS_Wins, Player.UserId)
Page.HighestWins.Text = "Highest Wins: ".. SavedWins
--local SavedSpree = DS_Spree:GetAsync(Player.UserId)
local SavedSpree = ReplicatedStorage.LocalBoardRemotes.GetOrdered:InvokeServer(DS_Spree, Player.UserId)
Page.HighestSpree.Text = "Highest Spree: ".. SavedSpree
--local SavedOther = DS_Other:GetAsync(Player.UserId)
local SavedOther = ReplicatedStorage.LocalBoardRemotes.GetData:InvokeServer(DS_Other, Player.UserId)
Page.TotalWins.Text = "Total Wins: ".. SavedOther[2]
Page.Deaths.Text = "Deaths: ".. SavedOther[3]
Page.KDR.Text = "KDR: ".. SavedOther[2]/SavedOther[3]
if SavedOther[4] then
Page.ArenaWins.Text = "Arena Wins: ".. SavedOther[4] --no more error
end
Page.ImageLabel.name.Text = Player.Name
Page.ImageLabel.Tier.Text = "Tier ".. ((math.floor(SavedOther[2] / 200)) + 1) -- Every Tier = 200 total wins
end
local function Update()
for _,v in pairs(List:GetChildren()) do
if v:IsA(“TextButton”) then
v:Destroy()
end
end
for _,v in pairs(Players:GetChildren()) do
local Button = script.TextButton:Clone()
Button.Text = v.Name
Button.Parent = List
Button.MouseButton1Down:Connect(function()
LoadPage(v)
Page.Visible = true
end)
end
your formatting is messed up but it seems like the ReplicatedStorage.LocalBoardRemotes.GetOrdered remote function is returning nil. We would need to see what that function does to help.
i have no idea i didn’t make it. my friend did. but
i think the point of that code is to where it’s trying to update or change the value of the text of “highest spree” same with wins and something is going nil when it’s updating or? i don’t get it
ctrl shift f to search every script for GetOrdered, you need to find the function the server attached to this RemoteFunction. Look for OnServerInvoke =
Please provide the script giving that error, and it would be helpful if you could add a comment noting which line the error comes from. My example should not result in that error.
local Part = script.Func
Part.Parent = workspace
wait(1)
local Key = workspace._DataStoreKey
local DS_Wins = "ds_wins".. Key.Value
local DS_Spree = "ds_spree".. Key.Value
local DS_Other = "ds_other".. Key.Value
local Players = game.Players
local Gui = Part.SurfaceGui
local List = Gui.ScrollingFrame
local Page = Gui.Page
local ReplicatedStorage = game.ReplicatedStorage
local function LoadPage(Player)
local Bust = ReplicatedStorage.LocalBoardRemotes.GetBust:InvokeServer(Player.UserId)
Page.ImageLabel.Image = Bust
--local SavedWins = DS_Wins:GetAsync(Player.UserId)
local SavedWins = ReplicatedStorage.LocalBoardRemotes.GetOrdered:InvokeServer(DS_Wins, Player.UserId)
Page.HighestWins.Text = "Highest Wins: ".. SavedWins
--local SavedSpree = DS_Spree:GetAsync(Player.UserId)
local SavedSpree = ReplicatedStorage.LocalBoardRemotes.GetOrdered:InvokeServer(DS_Spree, Player.UserId)
Page.HighestSpree.Text = "Highest Spree: ".. SavedSpree
--local SavedOther = DS_Other:GetAsync(Player.UserId)
local SavedOther = ReplicatedStorage.LocalBoardRemotes.GetData:InvokeServer(DS_Other, Player.UserId)
Page.TotalWins.Text = "Total Wins: ".. SavedOther[2]
Page.Deaths.Text = "Deaths: ".. SavedOther[3]
Page.KDR.Text = "KDR: ".. SavedOther[2]/SavedOther[3]
if SavedOther[4] then
Page.ArenaWins.Text = "Arena Wins: ".. SavedOther[4] --no more error
end
Page.ImageLabel.name.Text = Player.Name
Page.ImageLabel.Tier.Text = "Tier ".. ((math.floor(SavedOther[2] / 200)) + 1) -- Every Tier = 200 total wins
end
local function Update()
for _,v in pairs(List:GetChildren()) do
if v:IsA("TextButton") then
v:Destroy()
end
end
for _,v in pairs(Players:GetChildren()) do
local Button = script.TextButton:Clone()
Button.Text = v.Name
Button.Parent = List
Button.MouseButton1Down:Connect(function()
LoadPage(v)
Page.Visible = true
end)
end
end
Players.PlayerAdded:Connect(function() wait(1) Update() end)
Players.PlayerRemoving:Connect(function() wait(1) Update() end)
wait(1)
Update()
So you need different defaults for each value in your board script. It will be better to put the or at the call site instead, remove my last example and try this for the board script.
local SavedWins = ReplicatedStorage.LocalBoardRemotes.GetOrdered:InvokeServer(DS_Wins, Player.UserId) or 0
Page.HighestWins.Text = "Highest Wins: ".. SavedWins
--local SavedSpree = DS_Spree:GetAsync(Player.UserId)
local SavedSpree = ReplicatedStorage.LocalBoardRemotes.GetOrdered:InvokeServer(DS_Spree, Player.UserId) or 0
Page.HighestSpree.Text = "Highest Spree: ".. SavedSpree
--local SavedOther = DS_Other:GetAsync(Player.UserId)
local SavedOther = ReplicatedStorage.LocalBoardRemotes.GetData:InvokeServer(DS_Other, Player.UserId) or {0,0,0}
Page.TotalWins.Text = "Total Wins: ".. SavedOther[2]
Page.Deaths.Text = "Deaths: ".. SavedOther[3]
Page.KDR.Text = "KDR: ".. SavedOther[2]/SavedOther[3]
Nice job formatting! I would also recommend always have roblox format your code, regularly click this button
“Format Document” will correct indentation
thank you so much. and thank you for teaching me all this information in general. thank you very much this helped so much i’m so glad lol i knew it had something to do with the board code in that line of code area i just couldn’t do it all i knew was it had something to do with the number or something causing it to go nil but i couldn’t find it
um some reason the player stats aren’t updating to what the leaderstats are? can you please help? and thank you for that i never noticed that at all lol
This block of code leads me to believe you want this to continually update.
while task.wait(1) do
Update()
end
This will always update every second. The problem is that your code will invoke the server 3 times per player every second. It would be best to convert this board script to the server side, that way the clients aren’t all constantly using remote events and roblox can handle the replication faster. You would largely be replacing the Invoke Server calls with leaderstats references instead.
man i can’t do that solution the second thing you said. i can’t fix that problem with the code it isn’t mine it was made by one of my old friends from years ago. it was working fine before so i’m now needing help to fix