Whenever the player leaves the game, the script runs and it saves the obstacle course of the player. But it errors and says "Checkpoint is not a valid member of Camera "Workspace.Camera""
game:GetService("Players").PlayerRemoving:Connect(function(player)
local playerUserId = "Player_"..player.UserId
local PlayerStages = {}
for _, Obby in pairs(game:GetService("Workspace"):GetChildren()) do
if Obby.Name == "Obby1" or "Obby2" then
for __, SpawnLocation in pairs(Obby.Checkpoint:GetChildren()) do
if SpawnLocation:IsA("SpawnLocation") then
table.insert(PlayerStages, SpawnLocation, Obby)
end
end
end
end

3 comments
so how to fix it?
change line 6 to if Obby.Name == "Obby1" or Obby.Name == "Obby2" then
ok