#proximity prompt camera tweening

1 messages · Page 1 of 1 (latest)

valid portal
#

I need help with my proximity prompt camera transition. When the player interacts with the shop i want it to transition the player camera to the real gun store. Can anybody help or give me a template i can use for this?

#

where i want the camera to go after pressing it

junior bane
#

setup a part that faces the exact place you want to

#

then just set the players camera type to "scriptable"

#

and tween the position of the camera to that part

valid portal
junior bane
valid portal
#

and where do i put this at?

little anvilBOT
#

studio** You are now Level 2! **studio

valid portal
#

@junior bane

ancient berry
#

before the camera script?

junior bane
valid portal
junior bane
#

if u want it everytime a player resets/spawns then starter character scripts

#

if its just one time at join

#

starter player

valid portal
junior bane
valid portal
#

ahh okay

junior bane
#

put it in starter player

#

then just get the prompt via like

#

local prompt = workspace:WaitForChild("promptPart")

#

then

#

prompt.Triggered:Connect(function()
-- previous camera code here
end)

valid portal
#

so some like this?

junior bane
#

no no no

valid portal
#

oh..

junior bane
#

local script goes into "StarterPlayerScripts"

valid portal
#

oh yea i did that

#

this is for the interaction button

junior bane
#
local TweenService = game:GetService("TweenService")
local camera = workspace.CurrentCamera
local targetPart = workspace:WaitForChild("CameraPart")
local prompt = workspace:WaitForChild("Part"):WaitForChild("ProximityPrompt")

local tweenInfo = TweenInfo.new(
    2, 
    Enum.EasingStyle.Quart, 
    Enum.EasingDirection.Out
)

prompt.Triggered:Connect(function()
    camera.CameraType = Enum.CameraType.Scriptable

    local cameraTween = TweenService:Create(camera, tweenInfo, {
        CFrame = targetPart.CFrame
    })

    cameraTween:Play()
end)```
valid portal
#

i paste this into the local script thats in the proximity prompt?

junior bane
#

no

#

i've told you

#

local script under starterplayerscripts

valid portal
#

okay i did it

junior bane
#

then paste that code into that script

#

and change the targetPart and prompt paths as needed

valid portal
#

thank you so much

#

it worked

#

one question, if i ever wanted to get out of it and put it back to the players orignal camera. What do I do?

#

@junior bane

junior bane
#

camera.CameraType = Enum.CameraType.Custom

valid portal
junior bane
#

unless you want it to switch back after a specific action

#

like a button press

#

,etc

#

if so

#

workspace.CurrentCamera.CameraType = Enum.CameraType.Custom

valid portal
#

yea i want when a player presses a button it goes back

valid portal
junior bane
#
script.Parent.MouseButton1Click:Connect(function()
    workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end)```
#

smth like that

valid portal
#

how to make it only pop up when the player gets to the camera