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
The problem is at line 6. You placed that when "Obby2" is 'true' which Lua will approve and the first instance to come up in the Workspace is the camera, it will get the camera instead.