You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I’m trying to have my datastore save in game.
-
What is the issue? I cannot load the tools into the player after they leave.
-
What solutions have you tried so far? I tried if statements, adding different tables, and looked online to see if I could try anything else.
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!
if CameraData then
print("000")
for _, v in pairs(CameraData) do
print(111)
if cameraFolder:FindFirstChild(v) then
print("211")
local kameraKlone = game.ServerStorage.Cameras[v]:Clone()
kameraKlone.Parent = player.Backpack
print("Cameras loaded!")
end
end
end
game.Players.PlayerRemoving:Connect(function(player)
local baccpacc = player:FindFirstChild("Backpack"):GetChildren()
local Cameraz = game.ServerStorage.PlayerData[player.Name].Inventory:GetChildren()
local CameraTable = {}
for _,v in pairs(baccpacc)do
table.insert(Cameraz,v.Name)
print(707)
end
wait()
for _,v in pairs(Cameraz)do
table.insert(CameraTable,v.Name)
print(554)
end
PDs:SetAsync(player.UserId.."-cam",CameraTable)
print("Cameras saved!")
end)
There are no errors when I test this script.