Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

[ SOLVED ] Why won't camera go back to normal?

Asked by 1 month ago
Edited 1 month ago

So, in my game, there are a bunch of GUIs that change the camera to face a block. Well, I want it where, when you press the button the camera goes back to normal and it no longer faces the block. The two scripts are in separate buttons, by the way. Code to make it go back to normal:

script.Parent.MouseButton1Click:Connect(function()

game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic

end)

Script to make camera face a block:

script.Parent.MouseButton1Click:Connect(function()

    local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer

-- Camera --
repeat wait() until Player.Character
Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.Cutscene4.CFrame

end)

The only problem is, the camera doesn't change back to normal, it's stuck looking at the Cutscene4 block. Thank you!

2 answers

Log in to vote
0
Answered by 1 month ago

I think that the problem you have is that everytime you click both functions are processed and the second one for some reason seems to be the only one that ends up changing. Try binding the first function to say "rightclick"

0
Oh, sorry, I forgot to mention that the two scripts are in separate buttons... PadmeOragana 41 — 1mo
0
You seem to be changing the wrong camera setting. You should change the camera type not camera mode. greenhamster1 175 — 1mo
Ad
Log in to vote
0
Answered by 1 month ago

I ended up coming with my own solution. Script:

local player = game.Players.LocalPlayer

    player.CameraMode = Enum.CameraMode.LockFirstPerson
    wait(0)
    player.CameraMode = Enum.CameraMode.Classic

Thanks though!

Answer this question