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 to get data and turn it into a table, then when i want to save the data, i turn it back into a table
- What is the issue? Include screenshots / videos if possible!
Can someone explain this?
LIKE WHY IS IT DOING THAT LIKE 5K TIMES ITS LITTERLY THE FIRST TIME, THERE IS NO ERRORS…
print(game.GameId)
local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService"):GetDataStore("Data")
local HTTP = game:GetService("HttpService")
local Dummy = workspace.NPC.Worker
local TableFolder = require(game.ReplicatedStorage.TableFolderConverter)
Players.PlayerAdded:Connect(function(plr)
local plrId = plr.UserId
local des = Players:GetHumanoidDescriptionFromUserId(plrId)
if des then
Dummy.Humanoid:ApplyDescription(des)
wait(1)
local PickClone = script.PickaxeSpawnPart:Clone()
PickClone.Name = "PickaxeSpawnPart"
PickClone.Parent = Dummy
end
Dummy.Name = plr.Name
local l = Instance.new("Folder", plr)
l.Name = "Stats"
local StatsSystem = Instance.new("Folder", game.ReplicatedStorage.PlrData)
StatsSystem.Name = plr.Name
local c = Instance.new("NumberValue", l)
c.Name = "Cash"
c.Value = 0
local r = Instance.new("NumberValue", l)
r.Name = "Rebirths"
r.Value = 0
local p = Instance.new("NumberValue", l)
p.Name = "Prestiges"
p.Value = 0
local m = Instance.new("NumberValue", l)
m.Name = "Metals"
m.Value = 0
local StatsTable = {
Cash = c.Value,
Rebirths = r.Value,
Prestiges = p.Value,
Metals = m.Value
}
local ButtonTable = {
Button1 = true,
Button2 = false,
Button3 = false,
Button4 = false,
}
local LeaderboardTable = {
L1 = true,
L2 = false,
L3 = false,
L4 = false,
}
local DataTable = {
StatsFolder = StatsTable,
Buttons = ButtonTable,
Leaderboards = LeaderboardTable
}
local s,e = pcall(function()
if HTTP:JSONDecode(DSS:GetAsync(plr.UserId)) == nil or "" or {} then
DataTable = {
StatsFolder = StatsTable,
Buttons = ButtonTable,
Leaderboards = LeaderboardTable
}
print(DataTable)
else
DataTable = HTTP:JSONDecode(DSS:GetAsync(plr.UserId))
print(DataTable)
end
end)
print(s, e, DataTable)
TableFolder:_ToInstance(DataTable, game.ReplicatedStorage.PlrData:FindFirstChild(plr.Name))
wait(5)
while wait() do
for Type, Tables in DataTable do
if Type == "StatsFolder" then
for Item, Value in Tables do
if Item == c.Name then
Tables[Item] += 10000
c.Value = Tables[Item]
elseif Item == r.Name then
r.Value = Tables[Item]
elseif Item == p.Name then
p.Value = Tables[Item]
elseif Item == m.Name then
m.Value = Tables[Item]
end
end
end
end
TableFolder:_ToInstance(DataTable, game.ReplicatedStorage.PlrData:FindFirstChild(plr.Name))
end
end)
Players.PlayerRemoving:Connect(function(plr)
local BackToTable = TableFolder:_ToTable(game.ReplicatedStorage.PlrData:FindFirstChild(plr.Name))
DSS:SetAsync(plr.UserId, HTTP:JSONEncode(BackToTable))
print(BackToTable)
end)
game:BindToClose(function()
wait(5)
end)
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i honestly dont know what to do
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!
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.