The camera moves smoothly when pressed

Hello everyone. I am a novice developer and I would like to make a computer system like in fallout. When you click on it, the camera moves smoothly closer

  1. I want to make it so that when you click on the computer, the player’s camera moves smoothly to it

  2. The problem is that I have already tried to implement such a camera via RemoteEvent, but nothing worked out for me

  3. I’ve been looking for a solution but I haven’t found anything.

1 Like

you can Tween the camera CFrame, to move in front of the computer smoothly.
I dont know why you would need a RemoveEvent but if you want to do this, just Tween the workspace.CurrentCamera.CFrame to the position you like the client.

So you need it to just move camera slowly to computer?
You can create part and name it like “CameraPart” and make it invisible then through LocalScript and TweenService make tween:

local Camera = workspace.CurrentCamera
local CamPart = workspace:WaitForChild('CameraPart')
local TweenService = game:GetService('TweenService')

local params = TweenInfo.new(
	6, -- time
	Enum.EasingStyle.Exponential
)
local target = {
	CFrame = CamPart.CFrame
}
local tween = TweenService:Create(Camera,params,target)

Camera.CameraType = Enum.CameraType.Scriptable

tween:Play()

to make it go back you can do the same but the target will be players head and cameratype will be custom.

Good. I figured out how to move the camera smoothly, but I also need the camera to change when I click on an object.

You need to change camera position when you click object?
you can do the same but with the object cframe * offset

And another off-topic question: why is everyone doing
CamPart = workspace:WaitForChild(‘CameraPart’),
instead of CamPart = game.workspace.CameraPart?

Thats easier and more accurate way to do, if game does not loads in time :WaitForChild will wait for it.

I don’t really understand how this can be implemented. For example, I tried to make the camera just change when pressing ProximityPrompt, but it didn’t work out.

I can write you a script if you want to.

1 Like

I won’t mind if you show me how it can be done.

local Camera = workspace.CurrentCamera
local CamPart = workspace:WaitForChild('CameraPart')
local TweenService = game:GetService('TweenService')

local offset = CFrame.new(0,0,5)

local params = TweenInfo.new(
	6, -- time
	Enum.EasingStyle.Exponential
)
local target = {
	CFrame = CamPart.CFrame * offset
}
local tween = TweenService:Create(Camera,params,target)

Camera.CameraType = Enum.CameraType.Scriptable

tween:Play()

Thats with offset, you can change offset value as you want
Also theres service called as ProximityPromptService and it has event called PromptTriggered that returns in first argument the prompt that was triggered and you can just make object to move to first argument (promp that fired) parent

1 Like

if the prompt that was fired then if it has BoolValue “IsCameraInteractable” or smth like that then it will move to it

Good. I think I understood. Thanks

1 Like

Good luck developing your game, fell free to ask help.

Okay I didn’t really understand how it works. I understood what Prompt Triggered is, but I didn’t understand how to activate another script from it. As I understand it, the script that you gave me only works in StarterPlayerScript

How can I make sure that when I click on ProximityPrompt, the script that you gave me is activated?

I dont really understand you, do you need it to work on another parent or what?

You can just put there print("Activated") if you wanna know when its activated

Do you know if I can write in Russian here?

Да, ты можешь писать на любом языке.