I’m trying to save and load player’s data using a table to send one big data store request instead of tons of small little ones but I experience an error.
(i know it’s a lot There’s more lines but that isn’t relevant to the saving and loading)
local dss = game:GetService("DataStoreService")
local dataStore = dss:GetDataStore("GameXPData", 1)
local dataStore2 = dss:GetDataStore("PopUpsData", 1)
local lastPlaceData = dss:GetDataStore("LastLocation", 1)
local bannedPlayers = dss:GetDataStore("BannedUsers", 1)
local healthData = dss:GetDataStore("HealthData", 3)
local resetData = dss:GetDataStore("resetData", 3)
local eventData = dss:GetDataStore("EventData", 23)
local giftsData = dss:GetDataStore("GiftsData", 4)
local eventHandler = require(game.ReplicatedStorage.EasterEventModule)
local notifications = require(game.ReplicatedStorage.Notifications)
local httpService = game:GetService("HttpService")
local aBigDataTable = {}
--local num = dataStore:GetAsync(game.PlaceId.."-eventkeynum")
game.Players.PlayerAdded:Connect(function(plr)
local leaderboard = Instance.new("Folder", plr)
leaderboard.Name = "leaderstats"
local easterEventData = Instance.new("Folder", plr)
easterEventData.Name = "EasterEvent"
local xp = Instance.new("NumberValue", leaderboard)
xp.Name = "XP"
xp.Value = 0
local awardedXP = Instance.new("BoolValue", plr)
awardedXP.Value = false
awardedXP.Name = "AwardedXP"
local workArea = Instance.new("StringValue", plr)
workArea.Value = "None"
workArea.Name = "WorkArea"
local minutes = Instance.new("NumberValue", plr)
minutes.Value = 0
minutes.Name = "Minutes"
local merchantPurchases = Instance.new("NumberValue", plr)
merchantPurchases.Value = 0
merchantPurchases.Name = "MerchantPurchases"
local checkedShop = Instance.new("BoolValue", plr)
checkedShop.Value = false
checkedShop.Name = "CheckedShop"
local checkedChannel = Instance.new("BoolValue", plr)
checkedChannel.Value = false
checkedChannel.Name = "CheckedChannel"
local isBanned = Instance.new("BoolValue", plr)
isBanned.Name = "IsBanned"
isBanned.Value = false
local giftHasJoined = Instance.new("BoolValue", plr)
giftHasJoined.Name = "GHasJoined"
giftHasJoined.Value = false
local savedDate = Instance.new("StringValue")
local timeBanned = Instance.new("NumberValue", plr)
timeBanned.Name = "TimeBanned"
timeBanned.Value = 0
local banReason = Instance.new("StringValue", plr)
banReason.Name = "BanReason"
banReason.Value = "N/A"
local health = Instance.new("NumberValue", plr)
health.Value = 100
health.Name = "Health"
local hunger = Instance.new("NumberValue", plr)
hunger.Value = 100
hunger.Name = "Hunger"
local hasJoined = Instance.new("BoolValue", plr)
hasJoined.Value = true
hasJoined.Name = "HasJoined"
local PreviouslyJoined = Instance.new("BoolValue", plr)
PreviouslyJoined.Value = false
PreviouslyJoined.Name = "PreviouslyJoined"
local settingsHasJoined = Instance.new("BoolValue", plr)
settingsHasJoined.Value = false
settingsHasJoined.Name = "SHasJoined"
local Coins = Instance.new("NumberValue", leaderboard)
Coins.Name = "Coins"
Coins.Value = 0
local house = Instance.new("Folder", plr)
house.Name = "House"
local houses = Instance.new("NumberValue", house)
houses.Name = "Houses"
houses.Value = 0
--[[local eggs = Instance.new("NumberValue", easterEventData)
eggs.Value = 0
eggs.Name = "Eggs"
local hasEgg1 = Instance.new("BoolValue", easterEventData)
hasEgg1.Value = false
hasEgg1.Name = "HasEgg1"
local hasEgg2 = Instance.new("BoolValue", easterEventData)
hasEgg2.Value = false
hasEgg2.Name = "HasEgg2"
local hasEgg3 = Instance.new("BoolValue", easterEventData)
hasEgg3.Value = false
hasEgg3.Name = "HasEgg3"
local hasEgg4 = Instance.new("BoolValue", easterEventData)
hasEgg4.Value = false
hasEgg4.Name = "HasEgg4"
local hasEgg5 = Instance.new("BoolValue", easterEventData)
hasEgg5.Value = false
hasEgg5.Name = "HasEgg5"
local hasEgg6 = Instance.new("BoolValue", easterEventData)
hasEgg6.Value = false
hasEgg6.Name = "HasEgg6"
local hasEgg7 = Instance.new("BoolValue", easterEventData)
hasEgg7.Value = false
hasEgg7.Name = "HasEgg7"
local hasEgg8 = Instance.new("BoolValue", easterEventData)
hasEgg8.Value = false
hasEgg8.Name = "HasEgg8"
local hasEgg9 = Instance.new("BoolValue", easterEventData)
hasEgg9.Value = false
hasEgg9.Name = "HasEgg9"
local hasEgg10 = Instance.new("BoolValue", easterEventData)
hasEgg10.Value = false
hasEgg10.Name = "HasEgg10"
local hasEgg11 = Instance.new("BoolValue", easterEventData)
hasEgg11.Value = false
hasEgg11.Name = "HasEgg11"
local hasEgg12 = Instance.new("BoolValue", easterEventData)
hasEgg12.Value = false
hasEgg12.Name = "HasEgg12"
local hasEgg13 = Instance.new("BoolValue", easterEventData)
hasEgg13.Value = false
hasEgg13.Name = "HasEgg13"
local hasEgg14 = Instance.new("BoolValue", easterEventData)
hasEgg14.Value = false
hasEgg14.Name = "HasEgg14"
local hasEgg15 = Instance.new("BoolValue", easterEventData)
hasEgg15.Value = false
hasEgg15.Name = "HasEgg15"]]
--[[local CompletedObby = Instance.new("BoolValue", easterEventData)
CompletedObby.Value = false
CompletedObby.Name = "CompletedObby"
local hasAnnounced = Instance.new("BoolValue", easterEventData)
hasAnnounced.Value = false
hasAnnounced.Name = "HasAnnounced1"
local hasAnnounced2 = Instance.new("BoolValue", easterEventData)
hasAnnounced2.Value = false
hasAnnounced2.Name = "HasAnnounced2"]]
local hasAnnounced3 = Instance.new("BoolValue", easterEventData)
local isTeleporting = Instance.new("BoolValue", plr)
isTeleporting.Value = false
isTeleporting.Name = "IsTeleporting"
local Settings = Instance.new("Folder", plr)
Settings.Name = "Settings"
local gotXp = Instance.new("BoolValue", plr)
gotXp.Name = "GotXP"
gotXp.Value = false
local messageforXP = Instance.new("StringValue", plr)
messageforXP.Name = "XPMessage"
messageforXP.Value = "N/A"
local music = Instance.new("BoolValue", Settings)
music.Value = true
music.Name = "Music"
local shadows = Instance.new("BoolValue", Settings)
shadows.Value = true
shadows.Name = "Shadows"
local hasJoinedForXP = Instance.new("BoolValue", plr)
hasJoinedForXP.Value = false
hasJoinedForXP.Name = "HasJoinedXP"
local HJoined = Instance.new("BoolValue", plr)
HJoined.Value = false
HJoined.Name = "HJoined"
local lasttp = Instance.new("BoolValue", Settings)
lasttp.Value = false
lasttp.Name = "LastTP"
local xpGot = Instance.new("NumberValue", plr)
xpGot.Name = "XPGot"
xpGot.Value = 0
local function loadPlayerData()
local data
local success, fail = pcall(function()
data = dataStore:GetAsync(plr.UserId.."GameData")
end)
if success then
print("Successfully loaded data.")
if data ~= nil then
local playerData
print("Player data found.")
playerData = httpService:JSONDecode(tostring(dataStore:GetAsync(plr.UserId.."GameData")))
print("Data found. Data is: "..playerData)
xp.Value = playerData['XP']
health.Value = playerData["Health"]
merchantPurchases.Value = playerData[merchantPurchases.Name]
checkedShop.Value = playerData[checkedShop.Name]
PreviouslyJoined.Value = playerData[PreviouslyJoined.Name]
checkedShop.Value = playerData[checkedShop.Name]
checkedChannel.Value = playerData[checkedChannel.Name]
isBanned.Value = playerData[isBanned.Name]
isTeleporting.Value = playerData[isTeleporting.Name]
giftHasJoined.Value = playerData[giftHasJoined.Name]
banReason.Value = playerData[banReason.Name]
timeBanned.Value = playerData[timeBanned.Name]
hasJoined.Value = playerData[hasJoined.Name]
settingsHasJoined.Value = playerData[settingsHasJoined.Name]
Coins.Value = playerData[Coins.Name]
gotXp.Value = playerData[gotXp.Name]
messageforXP.Value = playerData[messageforXP.Value]
music.Value = playerData[music.Name]
shadows.Value = playerData[shadows.Name]
lasttp.Value = playerData[lasttp.Name]
HJoined.Value = playerData[HJoined.Name]
xpGot.Value = playerData[xpGot.Name]
hunger.Value = playerData[hunger.Name]
aBigDataTable[plr.Name] = httpService:JSONDecode(dataStore:GetAsync(plr.UserId.."GameData"))
else
hunger.Value = 100
health.Value = 100
music.Value = true
shadows.Value = true
lasttp.Value = false
--aBigDataTable[plr.Name] = httpService:JSONDecode(tostring(dataStore:GetAsync(plr.UserId.."GameData")))
if success ~= "" then
else
hunger.Value = 100
health.Value = 100
music.Value = true
shadows.Value = true
lasttp.Value = false
warn("Player data not found, or returned as nil.")
end
end
end
end
loadPlayerData()
if PreviouslyJoined.Value == false then
xp.Value = dataStore:GetAsync(plr.UserId.."XP")
Coins.Value = dataStore:GetAsync(plr.UserId.."Coins")
notifications:SendNotification(plr, "We have reset the data stores to a new version, but have got you your XP back from the previous data :D", "Hey!")
PreviouslyJoined.Value = true
end
--[[if giftHasJoined.Value == false then
gift1Min.Value = 4
gift1Sec.Value = 30
gift1Claimed.Value = false
gift2Min.Value = 8
gift2Sec.Value = 30
gift2Claimed.Value = false
giftHasJoined.Value = true
end]]
if settingsHasJoined.Value == false then
music.Value = true
shadows.Value = true
settingsHasJoined.Value = true
end
if gotXp.Value == true then
notifications:SendNotification(plr, "You got XP from a moderator! \n\n Message: "..messageforXP.Value.."! \n\n You got "..xpGot.Value.." XP! Congrats.", "Free XP!")
gotXp.Value = false
messageforXP.Value = "N/A"
xpGot.Value = 0
end
--[[if tpdata["CFrame"] ~= nil then
wait(4)
local success, fail = pcall(function()
plr.Character:WaitForChild("HumanoidRootPart").CFrame = tpdata["CFrame"]
end)
if success then
print("Brought player to last spot")
else
wait(1)
notifications:SendNotification(plr, "Oh-no! \n\n We ran into an error when bringing you to where you last were. Error: "..fail..".", "Error!")
warn("Failed to bring player to last spot "..fail)
end
end]]
local data4
local success, fail = pcall(function()
data4 = lastPlaceData:GetAsync(plr.UserId.."-lastposition")
end)
--[[local position = Instance.new("CFrameValue", plr)
position.Value.Position.X = Vector3.new(data4["x"])
position.Value.Position.Y = data4["y"]
position.Value.Position.Z = data4["z"] ]]
wait(0.1)
plr:LoadCharacter()
if lastPlaceData:GetAsync(plr.UserId.."-lastpositionx") ~= nil and success and isTeleporting.Value == true then
wait(4)
plr.Character:MoveTo(Vector3.new(lastPlaceData:GetAsync(plr.UserId.."-lastpositionx"), lastPlaceData:GetAsync(plr.UserId.."-lastpositiony"), lastPlaceData:GetAsync(plr.UserId.."-lastpositionz")))
-- game.ReplicatedStorage.TeleportPlayer:FireClient(plr, lastPlaceData:GetAsync(plr.UserId.."-lastpositionx"), lastPlaceData:GetAsync(plr.UserId.."-lastpositiony"), lastPlaceData:GetAsync(plr.UserId.."-lastpositionz"))
--plr.Character..Position = Vector3.new(lastPlaceData:GetAsync(plr.UserId.."-lastpositionx"), lastPlaceData:GetAsync(plr.UserId.."-lastpositiony"), lastPlaceData:GetAsync(plr.UserId.."-lastpositionz"))
wait(0.5)
lastPlaceData:RemoveAsync(plr.UserId.."-lastpositionx")
lastPlaceData:RemoveAsync(plr.UserId.."-lastpositiony")
lastPlaceData:RemoveAsync(plr.UserId.."-lastpositionz")
isTeleporting.Value = false
elseif fail then
warn("Failed to load last position data for "..plr.Name.."! Fail: "..fail)
lastPlaceData:RemoveAsync(plr.UserId.."-lastpositionx")
lastPlaceData:RemoveAsync(plr.UserId.."-lastpositiony")
lastPlaceData:RemoveAsync(plr.UserId.."-lastpositionz")
isTeleporting.Value = false
elseif lasttp.Value == true and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 153894207) then
wait(4)
plr.Character:MoveTo(Vector3.new(lastPlaceData:GetAsync(plr.UserId.."-lastpositionx"), lastPlaceData:GetAsync(plr.UserId.."-lastpositiony"), lastPlaceData:GetAsync(plr.UserId.."-lastpositionz")))
end
plr.CharacterAdded:Connect(function(char)
plr.WorkArea.Value = "None"
end)
if isBanned.Value == true then
local suceed,failed = pcall(function()
game:GetService("TeleportService"):Teleport(12457693715, plr)
end)
if suceed then
print("Successfully teleported "..plr.Name.." to the restricted area!")
else
plr:Kick("[Auto Kick]: You are banned form King's Kingdom! Reason: Restricted area teleport failed or timed out.")
end
end
if hasJoinedForXP.Value == false and plr:GetRankInGroup(7048567) >= 3 then
notifications:SendNotification(plr, "🎉You have been given 200+ Free XP! We apologize for the confusion that may have happened in the past few days. This is a one time thing and you won't be able to claim again! We apologize about any inconvience.🎉", "Hey!")
xp.Value += 200
hasJoinedForXP.Value = true
notifications:SendGlobalChatNotification("[System]: "..plr.Name.." has just earned 200+ Free XP!")
end
local HttpService = game:GetService("HttpService")
plr.Chatted:Connect(function(msg)
if msg == "/rejoin" then
notifications:SendNotification(plr, "You are rejoining, please wait one moment while we save your data. Please DO NOT leave the game, if you do this may result in data loss.", "Hey!")
--[[ local teleportService = game:GetService("TeleportService")
local plrcount = 0
local options = Instance.new("TeleportOptions")
print("Setting teleport data")
-- notifications:SendNotification(plr,"❌Uh-oh!❌ \n\n Sorry, but this feature is temporarily disabled due to bugs with the event. This feature will be enabled again after the Easter Event is over.","Error!")
for i,v in pairs(game.Players:GetPlayers()) do
i += 1
plrcount = i
end
if plrcount >= 3 then
local positionTable = {["CFrame"] = plr.Character.HumanoidRootPart.CFrame} --["x"] = plr.Character.HumanoidRootPart.Position.X, ["y"] = plr.Character.HumanoidRootPart.Position.Y, ["z"] = plr.Character.HumanoidRootPart.Position.Z}
options:SetTeleportData(positionTable)
teleportService:Teleport(12073023350, plr, options )
else
local positionTable = {["CFrame"] = plr.Character.HumanoidRootPart.CFrame} --["x"] = plr.Character.HumanoidRootPart.Position.X, ["y"] = plr.Character.HumanoidRootPart.Position.Y, ["z"] = plr.Character.HumanoidRootPart.Position.Z}
options:SetTeleportData(positionTable)
teleportService:Teleport(13206085683, plr, positionTable)
end]]
local function savePlayerData()
local encodedData = httpService:JSONEncode(aBigDataTable[plr.Name])
pcall(function()
dataStore:SetAsync(encodedData)
end)
end
for i,v in pairs(plr.leaderstats:GetChildren()) do
aBigDataTable[plr.Name][v.Name] = v.Value
end
for i,v in pairs(plr:GetChildren()) do
if v:IsA("IntValue") or v:IsA("BoolValue") or v:IsA("NumberValue") and v.Name ~= "Minutes" and v.Name ~= "WorkArea" then
aBigDataTable[plr.Name][v.Name] = v.Value
end
end
for i,v in pairs(plr.Settings:GetChildren()) do
aBigDataTable[plr.Name][v.Name] = v.Value
end
aBigDataTable[plr.Name]["Health"] = plr.Health.Value
aBigDataTable[plr.Name]["Hunger"] = plr.Hunger.Value
savePlayerData()
-- local PositionTable = HttpService:JSONEncode({["x"] = plr.Character:WaitForChild("HumanoidRootPart").Position.X,["y"] = plr.Character:WaitForChild("HumanoidRootPart").Position.Y,["z"] = plr.Character:WaitForChild("HumanoidRootPart").Position.Z})
lastPlaceData:SetAsync(plr.UserId.."-lastpositionx", plr.Character.HumanoidRootPart.Position.X)
lastPlaceData:SetAsync(plr.UserId.."-lastpositiony", plr.Character.HumanoidRootPart.Position.Y)
lastPlaceData:SetAsync(plr.UserId.."-lastpositionz", plr.Character.HumanoidRootPart.Position.Z)
dataStore:SetAsync(plr.UserId.."IsTeleporting", true)
isTeleporting.Value = true
wait(0.5)
local plrcount
for i,v in pairs(game.Players:GetPlayers()) do
i += 1
plrcount = i
end
if plrcount >= 3 then
game:GetService("TeleportService"):Teleport(12073023350, plr)
else
game:GetService("TeleportService"):Teleport(13206085683, plr)
end
end
if plr:GetRankInGroup(7048567) >= 20 then
local words = string.split(msg, " ")
if words[1] == "-ban" then
local id = words[2]
local userID = tonumber(id)
local timeBanned = words[3]
local reason = words[4]
local reasonNum = tonumber(reason)
local success, fail = pcall(function()
-- dataStore:SetAsync(userID.."IsBanned", true)
local player = game.Players:GetPlayerByUserId(userID)
player.IsBanned.Value = true
-- dataStore:SetAsync(userID.."TimeBanned", tonumber(timeBanned))
player.TimeBanned.Value = tonumber(timeBanned)
if reasonNum == 1 then
-- dataStore:SetAsync(userID.."BanReason", "You have been fired / demoted by "..plr.Name..".")
banReason.Value = "You have been fired / demoted by "..plr.Name.."."
elseif reasonNum == 2 then
-- dataStore:SetAsync(userID.."BanReason", "You have been punished for breaking a rule on our striking table and reaching the required punishment level to be jailed! Banned by: "..plr.Name..".")
banReason.Value = "You have been punished for breaking a rule on our striking table and reaching the required punishment level to be jailed! Banned by: "..plr.Name.."."
elseif reasonNum == 3 then
-- dataStore:SetAsync(userID.."BanReason", "You have been purged by "..plr.Name..".")
banReason.Value = "You have been purged by "..plr.Name.."."
elseif reasonNum == 4 then
-- dataStore:SetAsync(userID.."BanReason", "You have resigned by opening a ticket on our communications server. You were banned by: "..plr.Name..". (this is so the admin can reset)")
banReason.Value = "You have resigned by opening a ticket on our communications server. You were banned by: "..plr.Name..". (this is so the admin can reset)"
elseif reasonNum == 5 then
-- dataStore:SetAsync(userID.."BanReason", "You have resigned without informing us. Banned by: "..plr.Name..". (this ban is longer because you did not tell us you were resigning)")
banReason.Value = "You have resigned without informing us. Banned by: "..plr.Name..". (this ban is longer because you did not tell us you were resigning)"
elseif reasonNum == 6 then
-- dataStore:SetAsync(userID.."BanReason", "You have abused their powers and are being demoted. Banned by: "..plr.Name..".")
banReason.Value = "You have abused their powers and are being demoted. Banned by: "..plr.Name.."."
elseif reasonNum == 7 then
-- dataStore:SetAsync(userID.."BanReason", "You have reached the maximum punishment level. Banned by: "..plr.Name..".")
banReason.Value = "You have reached the maximum punishment level. Banned by: "..plr.Name.."."
end
end)
if success then
print("Successfully banned "..userID.."!")
local player = game.Players:GetPlayerByUserId(userID)
player:Kick("[Auto Kick]: You were kicked by a high rank. Reason: Banned.")
else
warn("Error banning "..userID.."! Reason: "..fail)
end
end
end
-- Give XP Command
if plr:GetRankInGroup(7048567) >= 20 then
local words = string.split(msg, ";")
if words[1] == "-addxp" then
local id = words[2]
local p = game.Players:GetPlayerByUserId(tonumber(id))
local amount = words[3]
local xpamount
local reason = words[4]
local newXPAmount
local filteredMessage
local s,f = pcall(function()
filteredMessage = game.Chat:FilterStringForBroadcast(reason, plr)
end)
if f then
filteredMessage = "Failed to filter."
notifications:SendNotification(plr, "Your message failed to filter. :(", plr)
end
if not p then
notifications:SendNotification(plr, "You did not provide a valid player's UserID.", "Error!")
elseif tonumber(amount) <= 0 then
notifications:SendNotification(plr, "You cannot remove XP by using this command. You may only add an amount that is greater than 0.", "Error!")
end
if p then
notifications:SendNotification(plr, "Retrieved user. Username: "..p.Name..". ID: "..p.UserId..". Attempting to add XP to user.", "Hey!")
xpamount = dataStore:GetAsync(p.UserId.."XP")
newXPAmount = xpamount + tonumber(amount)
local s1,f1 = pcall(function()
dataStore:SetAsync(p.UserId.."XP", newXPAmount)
dataStore:SetAsync(p.UserId.."GotXP", true)
dataStore:SetAsync(p.UserId.."XPMessage", filteredMessage)
dataStore:SetAsync(p.UserId.."XPGot", tonumber(amount))
end)
if s1 then
notifications:SendNotification(plr, "Successfully added XP to user!", "Hey!")
else
notifications:SendNotification(plr, "There was an error when attempting to add the XP to the user. Error: "..f1..".", "Hey!")
end
end
end
end
if plr:GetRankInGroup(7048567) >= 20 then
local words = string.split(msg, " ")
if words[1] == "-unban" then
local userID = words[2]
local timeBanned = words[3]
local success, fail = pcall(function()
dataStore:RemoveAsync(userID.."-banned")
dataStore:RemoveAsync(userID.."-bannedtime")
game:GetService("MessagingService"):PublishAsync("Unban", plr.UserId)
end)
if success then
print("Successfully unbanned "..userID.."!")
local player = game.Players:GetPlayerByUserId(userID)
player:Kick("[Auto Kick]: You were kicked by a high rank. Reason: Banned.")
else
warn("Error banning "..userID.."! Reason: "..fail)
end
end
end
end)
while wait(60*60) do
if plr.Minutes.Value > 0 then
plr.Minutes.Value -= 1
end
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local function savePlayerData()
local encodedData = httpService:JSONEncode(aBigDataTable[plr])
local success, fail = pcall(function()
dataStore:SetAsync(encodedData)
end)
if success then
print("Successfully encoded and saved data.")
else
warn("An error occured when attempting to encode and / or save the data.")
end
end
for i,v in pairs(plr.leaderstats:GetChildren()) do
table.insert(aBigDataTable[plr][v.Name], v.Value)
print("Added "..v.Name.." to the table. Value: "..v.Value..".")
end
for i,v in pairs(plr:GetChildren()) do
if v:IsA("IntValue") or v:IsA("BoolValue") or v:IsA("NumberValue") and v.Name ~= "Minutes" and v.Name ~= "WorkArea" then
aBigDataTable[plr][v.Name] = v.Value
print("Added "..v.Name.." to the table. Value: "..v.Value..".")
end
end
for i,v in pairs(plr.Settings:GetChildren()) do
aBigDataTable[plr][v.Name] = v.Value
print("Added "..v.Name.." to the table. Value: "..v.Value..".")
end
aBigDataTable[plr]["Health"] = plr.Health.Value
aBigDataTable[plr]["Hunger"] = plr.Hunger.Value
savePlayerData()
--[[
if plr.IsTeleporting.Value == false then
for i,v in pairs(plr.Settings:GetChildren()) do
local success, fail = pcall(function()
local success,fail = pcall(function()
dataStore:SetAsync(plr.UserId..v.Name)
end)
end)
end
for i,v in pairs(plr.Gifts:GetChildren()) do
if v:IsA("NumberValue") or v:IsA("BoolValue") or v:IsA("IntValue") then
local success, fail = pcall(function()
dataStore:SetAsync(plr.UserId..v.Name, v.Value)
end)
wait()
end
end
for i,v in pairs(plr:GetChildren()) do
if v:IsA("NumberValue") or v:IsA("BoolValue") or v:IsA("StringValue") or v:IsA("IntValue") and v.Name ~= "Minutes" then
local success, fail = pcall(function()
dataStore:SetAsync(plr.UserId..v.Name, v.Value)
end)
end
wait()
end
for i,v in pairs(plr.leaderstats:GetChildren()) do
local success, fail = pcall(function()
dataStore:SetAsync(plr.UserId..v.Name, v.Value)
end)
wait()
end
for i,v in pairs(plr.EasterEvent:GetChildren()) do
local success, fail = pcall(function()
eventData:SetAsync(plr.UserId..v.Name, v.Value)
end)
wait()
end
end]]
end)
I’ve been trying to fix this for hours any help is appreciated.