You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the plrs rank value(value is a string) to save thru the datastore -
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions
on the Developer Hub?
i looked all over the developer hub tonumber seemed to work for everybody else but not me
i tried changing the name from rank to lvl and it still does the same thing
i have 2 global leaderboard that work just fine both are intvalues
and yes, i know it looks sloppy.
rank script:
wait(5)
local DSS = game:GetService(“DataStoreService”)
local RankDS = DSS:GetOrderedDataStore(“RankDatas”)
local GlobalBoard = script.Parent
local NewFlipUI = game.ReplicatedStorage.BestRankUI
local UpdateTime = 10
local k
local function comma_value(amount)
while true do
amount, k = string.gsub(amount, “^(-?%d+)(%d%d%d)”, ‘%1,%2’)
print(amount)
if (k==0) then
break
end
end
return amount
end
local stringg = “football” – test
tonumber(stringg,2)
local function UpdateBoard()
for i, plr in pairs(game.Players:GetChildren()) do
local Lvl = plr.leaderstats:FindFirstChild("Lvl")
if Lvl then
local LvlValue = tonumber(Lvl.Value)
RankDS:SetAsync(plr.UserId, LvlValue) -- this is where the problem is it prints arg 2 missing or nil every single time ive been trying to firgure this out for 1/2 hrs
end
end
local Success, Erorr = pcall(function()
local Data = RankDS:GetSortedAsync(false,10)
local SpentPage = Data:GetCurrentPage()
for rank, SavedData in ipairs(SpentPage) do
local User = game.Players:GetNameFromUserIdAsync(tonumber(SavedData.key))
local RRank = SavedData.value
if RRank then
local NewBoard = NewFlipUI:Clone()
NewBoard.Parent = GlobalBoard.SurfaceGui.Frame.ScrollingFrame
NewBoard.PlrName.Text = User
NewBoard.Amount.Text = RRank
print(RRank)
NewBoard.Number.Text = rank
print("yes")
end
end
end)
end
while true do
for _, Frame in pairs(GlobalBoard.SurfaceGui.Frame.ScrollingFrame:GetChildren()) do
if Frame:IsA("Frame") then
Frame:Destroy()
end
end
UpdateBoard()
wait(UpdateTime)
end
if anybody knows could i use a intvalue instead of a string to save the plrs rank value which is a(string)
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.