local tp = game:GetService("TeleportService")
local players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local PrivateServerCodes = DataStoreService:GetOrderedDataStore("PrivateServerCodes")
game:GetService('ReplicatedStorage').PublishServerCode.OnServerEvent:Connect(function(player, code, Jobid)
local function printCodePages()
local isAscending = false
local pageSize = 100
local pages = PrivateServerCodes:GetSortedAsync(isAscending, pageSize)
local CurrentPage = pages:GetCurrentPage()
for rank, data in ipairs(CurrentPage) do
local Code = data.key
local JobId = data.value
print(Code .. " Is the code, and " .. JobId .. " Is the JobId ")
end
-- Potentially load the next page...
--pages:AdvanceToNextPageAsync()
end
-- Publish the code as the key and the JobId as the value (Which can't be a string)
PrivateServerCodes:SetAsync(code, Jobid)
printCodePages()
end)
The code:
88639056 (Expected)
The JobId:
e49b0b05-47f8-f0ab-dbc7-1e3090476300 (Also expected)
Now that Iām back, hereās two ways you can go about this:
1.) JSONEncode
2.) Create a table, with keys perhaps that actually have the keys, and then set the saved value of the index in the table to require the string fromā¦?
Iām unsure honestly,
Iām looking more into some documentation so that I can find a way to help though!
But hereās an example, directly from the documentation that helps serialize to store more data types:
The documentation also provides a little more of an explanation too.
local tab = {
-- Remember: these lines are equivalent
["message"] = "success";
message = "success";
info = {
points = 123,
isLeader = true,
user = {
id = 12345,
name = "JohnDoe"
},
past_scores = {50, 42, 95},
best_friend = nil
}
}
local json = HttpService:JSONEncode(tab)
print(json)