Hello It’s my first time posting on the devforum I have recently ran into a error that says that the MainMenuCamera part is not a valid member of the workspace even though it is.
I have tried re adding the part to no success I have tried to do it with WaitForChild() with little to no success FindFirstChild() also did not work
local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local runService = game:GetService("RunService")
local defaultCframe = camera.CFrame
local connection
connection = runService.RenderStepped:Connect(function()
wait()
camera.CFrame = game.Workspace.MainMenuCamera.CFrame
end)
game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
connection = runService.RenderStepped:Connect(function()
wait()
camera.CFrame = game.Workspace.MainMenuCamera.CFrame
end)
end)
script.Parent.MouseButton1Click:Connect(function()
wait(0.2)
camera.CameraType = Enum.CameraType.Custom
player:LoadCharacter()
connection:Disconnect()
end)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local runService = game:GetService("RunService")
local camerapart = workspace:WaitForChild("MainMenuCamera")
local defaultCframe = camera.CFrame
local connection
connection = runService.RenderStepped:Connect(function()
task.wait()
camera.CFrame = camerapart.CFrame
end)
character:WaitForChild("Humanoid").Died:Connect(function()
connection = runService.RenderStepped:Connect(function()
task.wait()
camera.CFrame = camerapart.CFrame
end)
end)
script.Parent.MouseButton1Click:Connect(function()
task.wait(0.2)
camera.CameraType = Enum.CameraType.Custom
player:LoadCharacter()
connection:Disconnect()
end)