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

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

Asked by 4 years ago
Edited 4 years 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:

1script.Parent.MouseButton1Click:Connect(function()
2 
3game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
4 
5end)

Script to make camera face a block:

01script.Parent.MouseButton1Click:Connect(function()
02 
03    local Camera = game.Workspace.CurrentCamera
04local Player = game.Players.LocalPlayer
05 
06-- Camera --
07repeat wait() until Player.Character
08Camera.CameraType = "Scriptable"
09Camera.CFrame = game.Workspace.Cutscene4.CFrame
10 
11end)

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
1
Answered by 4 years 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 78 — 4y
0
You seem to be changing the wrong camera setting. You should change the camera type not camera mode. greenhamster1 180 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I ended up coming with my own solution. Script:

1local player = game.Players.LocalPlayer
2 
3    player.CameraMode = Enum.CameraMode.LockFirstPerson
4    wait(0)
5    player.CameraMode = Enum.CameraMode.Classic

Thanks though!

Answer this question