Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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"

2 comments

0

Oh, sorry, I forgot to mention that the two scripts are in separate buttons...

0

You seem to be changing the wrong camera setting. You should change the camera type not camera mode.

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.