Hello guys !
I’m having a problem to load a lot of values but those values are not all the same I have some string and Intvalue and idk how can I load them when the player join
this is my load im sorry but I have really no idea to
local data
local success, er = pcall(function()
data = PlayerData:GetAsync("playerdata"..player.UserId)
end)
if data and success then
--print("Loaded")
else
--print(player.Name.." Has joined for the first time")
end
if success then
if data then
local QuestSettingsBlackBearQuest = BlackBearQuest:FindFirstChild("QuestSettingsBlackBearQuest") or Instance.new("Folder", BlackBearQuest)
QuestSettingsBlackBearQuest.Name = "QuestSettingsBlackBearQuest"
for i, v in pairs(data) do
--Here how can I know what was the value ?
end
else
print("Failed to load data")
end
else
warn(er)
end
this is my save values I know this is working
game.Players.PlayerRemoving:Connect(function(player)
local quest = player:WaitForChild("Quest")
local data = {}
for i, v in pairs(player.Quest.BlackBearQuest.QuestSettingsBlackBearQuest:GetChildren()) do
if v.Name == "QuestTask" then
table.insert(data, i, v.Value, "StringValue")
elseif v.Name == "QuestReward" then
table.insert(data, i, v.Value, "IntValue")
elseif v.Name == "QuestRewardBoost" then
table.insert(data, i, v.Value, "StringValue")
elseif v.Name == "QuestRewardBoostFolder" then
table.insert(data, i, v.Value, "StringValue")
elseif v.Name == "QuestGoal" then
table.insert(data, i, v.Value, "IntValue")
elseif v.Name == "QuestAuraName" then
table.insert(data, i, v.Value, "StringValue")
elseif v.Name == "QuestTitle" then
table.insert(data, i, v.Value, "StringValue")
end
print(v, i, data)
end
local success, err = pcall(function()
PlayerData:SetAsync("playerdata"..player.UserId, data)
end)
if success then
--print("data saved")
else
player:Kick("There was an error loaded your data")
warn(err)
end
end)
im sorry to ask you this but idk how to do it, im a beginner and I’ve found nothing on the web. Thanks