Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it change the camera position to normal once the play button is played?

Asked by 4 years ago

When you press the play button, it changes to the normal camera mode, How do i do it?

code:

local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local frame = script.Parent.Frame
local defaultCframe = camera.CFrame
local view = 150
local blur = game.Lighting.Blur
blur.Size = 12

if
    frame.Visible == true
then
    frame.IntroSound:Play()
end

if
    frame.Visible == true
then
    blur.Enabled = true
end

blur.Size = 12

function updateCamera()
    camera.CFrame = game.Workspace.Models.CameraPart.CFrame
end

game:GetService("RunService").RenderStepped:Connect(updateCamera)

script.Parent.Frame.PlayButton2.MouseButton1Click:Connect (function()
    script.Parent.Frame.IntroSound:Stop()
    blur.Enabled = false
    frame.Visible = false
    camera.CameraType = Enum.CameraType.Custom

end)

1 answer

Log in to vote
0
Answered by
drcelt -3
4 years ago

This code is from my menu script: (make sure this is a local script) This is what shows the camera:

local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local lighting = game.Lighting
local defaultcframe = camera.CFrame
local view = 150    
local menucam = workspace.Scripts.MenuCam

script.Parent.Enabled = true
wait(0.2)


function updateCam()
    camera.CFrame = menucam.CFrame
end


game:GetService("RunService").RenderStepped:Connect(updateCam)

This is what deletes the camera part and puts it back to normal, the players head:

local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local lighting = game.Lighting
local defaultcframe = camera.CFrame
local view = 150    
local menucam = workspace.Scripts.MenuCam

script.Parent.MouseButton1Click:Connect(function()
    wait(0.2)
    camera.CameraType = Enum.CameraType.Custom
    script.Parent.Parent.Parent:Destroy()
end)

Hopefully this helps

Ad

Answer this question