I'm trying to make a script that :GetChildren then removes them from the local camera.
game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() c = game.Workspace.CurrentCamera:GetChildren() end) end) end)
The CurrentCamera
is only available from LocalScripts.
As a consequence, it is not meaningful for a script to use both CurrentCamera
and the PlayerAdded
event.
Instead, wherever it is that you put objects into the camera, begin that script by clearing them out.
Alternatively, just have a separate LocalScript in the PlayerGui that clears it out (run each time they spawn, so as long as everything else waits a bit, it should be fine)
-- A LocalScript c = game.Workspace.CurrentCamera:GetChildren() for _, child in pairs(c) do child:Destroy() end