Moving Camera when ProximityPrompt is Triggered

I am trying to work on a Golf Driving Range.

And to enter the Golf Mat I have a ProximityPrompt that you would trigger your camera to be tweened back so you can view your character and would move your player to the StandingPosition part. (Model pic shown below)

Like this view.

I am not quite familiar with cameras and looking for help on a simple question.

How would I make the player’s camera move back and lock the player in place until they back out by hitting ESC or some button?

Here is the script that I had tried with research on this topic and what’s in the GolfMat Model.

You will want to set your camera to scriptable, currently it’s set to custom. You can do so by this in the triggered event:

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable

To revert it back to normal, set the camera type to custom like so:

workspace.CurrentCamera.CameraType = Enum.CameraType.Custom

I tried testing it in a Local Script and it would not do anything so I moved it to a normal Script and got this error.

I am just not familiar with cameras so I am not sure what I did wrong.

OH I made a minor mistake, whoopsies! Try this in a local script:

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable

And would you know how to tween them so your camera goes to the Camera part?

The code you provided earlier should work, just be sure you are setting CameraType before tweening.

Oh, I think my problem is now that I looked up and it said how proximity prompts can’t work with local scripts so you would do a remote event.

Yes, you will need to fire a remote event.

Okay thank you I finally got it after much frustration lol

1 Like