Hi guys! This is an ordered datastore gui, and I am trying to make it compatible with name changing. Basically, I am now saving the id of the player so I can load their current name when they join.
However, although it is working, it is now displaying like so on the leaderboard:
- jjwood1600
- 4418264 (the id of the player)
Any ideas why it is doing this? Other than that it works fine. Thanks.
local ODS = game:GetService("DataStoreService"):GetOrderedDataStore("Escapes")
local pages = ODS:GetSortedAsync(false, 10)
local Count = 0
local Gui = script.Parent
function Leaderboard()
Count = 0
local data = pages:GetCurrentPage()
for i,item in next, (data) do
Count = Count + 1
local Board = Gui:FindFirstChild("Place"..Count.."")
if type(item.key) == "number" then
name = game.Players:GetNameFromUserIdAsync(item.key)
Board.PName.Text = name
else
Board.PName.Text = item.key
end
Board.Score.Text = item.value
if Count == 10 then return end
end
end
Leaderboard()
function PlayerLeaving(Player)
ODS:SetAsync(Player.userId, Player.leaderstats.Escapes.Value)
end
game.Players.PlayerRemoving:connect(PlayerLeaving)

1 comment
I'll test it ASAP and let you know how it goes! :) Thanks!