I want to make it so the table formats and saves in the datasaving.
The folder doesn’t create and it says there is nothing in the table.
I have tried everything (basically)
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!
THE SCRIPT:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Manager = require(script.Modules.Manager)
local Template = require(script.Modules.Datastores)
local ProfileService = require(script.ProfileService)
local ProfileStore = ProfileService.GetProfileStore("RiceFarmingGameData", Template)
local function OnDataChanged(Stat, Value, OldSat, NewPlayer)
local True = Value - OldSat
local Sign = ""
if Value >= OldSat then
Sign = "+"
else
Sign = ""
end
ReplicatedStorage.Remotes:WaitForChild("StatsChanged"):FireClient(NewPlayer, Stat.Name, True, Sign)
end
local function LeaderStats(NewPlayer: Player)
local Profile = Manager.Profiles[NewPlayer]
if not Profile then
return
end
local QuestsFolder = Instance.new("Folder", NewPlayer)
QuestsFolder.Name = "questsfolder"
for Index, Quest in ipairs(Profile.Data) do
local QuestFolder = Instance.new("Folder", QuestsFolder)
QuestFolder.Name = Quest.Title
local Progress = Instance.new("NumberValue", QuestFolder)
Progress.Name = "Progress"
Progress.Value = Profile.Data.Quests[Quest.Title].Progress
local Completed = Instance.new("BoolValue", QuestFolder)
Completed.Name = "Completed"
Completed.Value = Profile.Data.Quests[Quest.Title].Completed
end
local LeaderStats = Instance.new("Folder", NewPlayer)
LeaderStats.Name = "leaderstats"
local Cash = Instance.new("NumberValue", LeaderStats)
Cash.Name = "Rmb"
Cash.Value = Profile.Data.Rmb
local Level = Instance.new("NumberValue", LeaderStats)
Level.Name = "Power"
Level.Value = Profile.Data.Power
for Index, Stat in ipairs(LeaderStats:GetChildren()) do
local OldSat = Stat.Value
Stat.Changed:Connect(function(Value)
OnDataChanged(Stat, Value, OldSat, NewPlayer)
OldSat = Value
end)
end
end
local function PlayerAdded(NewPlayer: Player)
local Profile = ProfileStore:LoadProfileAsync("PlayerData_".. NewPlayer.UserId)
if Profile == nil then
NewPlayer:Kick("Issue getting data, please rejoin.")
return
end
Profile:AddUserId(NewPlayer.UserId)
Profile:Reconcile()
Profile:ListenToRelease(function()
Manager.Profiles[NewPlayer] = nil
NewPlayer:Kick("Issue getting data, please rejoin.")
end)
if NewPlayer:IsDescendantOf(Players) then
Manager.Profiles[NewPlayer] = Profile
LeaderStats(NewPlayer)
else
Profile:Release()
end
end
local function PlayerRemoving(NewPlayer: Player)
local Profile = Manager.Profiles[NewPlayer]
if not Profile then
return
end
Profile:Release()
end
for Index, NewPlayer in Players:GetPlayers() do
task.spawn(PlayerAdded, NewPlayer)
end
Players.PlayerAdded:Connect(PlayerAdded)
Players.PlayerRemoving:Connect(PlayerRemoving)
WHERE I NEED HELP:
local QuestsFolder = Instance.new("Folder", NewPlayer)
QuestsFolder.Name = "questsfolder"
for Index, Quest in ipairs(Profile.Data) do
local QuestFolder = Instance.new("Folder", QuestsFolder)
QuestFolder.Name = Quest.Title
local Progress = Instance.new("NumberValue", QuestFolder)
Progress.Name = "Progress"
Progress.Value = Profile.Data.Quests[Quest.Title].Progress
local Completed = Instance.new("BoolValue", QuestFolder)
Completed.Name = "Completed"
Completed.Value = Profile.Data.Quests[Quest.Title].Completed
end
AHHHHHHHH