This code is from my menu script:
(make sure this is a local script)
This is what shows the camera:
01 | local player = game.Players.LocalPlayer |
02 | local character = player.CharacterAdded |
03 | local mouse = player:GetMouse() |
04 | local camera = game.Workspace.CurrentCamera |
05 | local lighting = game.Lighting |
06 | local defaultcframe = camera.CFrame |
08 | local menucam = workspace.Scripts.MenuCam |
10 | script.Parent.Enabled = true |
15 | camera.CFrame = menucam.CFrame |
19 | game:GetService( "RunService" ).RenderStepped:Connect(updateCam) |
This is what deletes the camera part and puts it back to normal, the players head:
01 | local player = game.Players.LocalPlayer |
02 | local character = player.CharacterAdded |
03 | local mouse = player:GetMouse() |
04 | local camera = game.Workspace.CurrentCamera |
05 | local lighting = game.Lighting |
06 | local defaultcframe = camera.CFrame |
08 | local menucam = workspace.Scripts.MenuCam |
10 | script.Parent.MouseButton 1 Click:Connect( function () |
12 | camera.CameraType = Enum.CameraType.Custom |
13 | script.Parent.Parent.Parent:Destroy() |
Hopefully this helps