How can i make the camera follow the player?

Well, i want to make the camera follow the player for a lever script. Can anyone help me? here what i’m talking about: https://youtube.com/clip/UgkxtUo2gHnxuu-cBq_3MsBtCm2rLgbpDE4v?si=RHnwqAhX_v9Ntstk

4 Likes

Can you see when he pulls the lever, the camera just follow it?

To do what the camera is doing in the video, you need to change the CameraType to “Attach.” More information here: CameraType | Documentation - Roblox Creator Hub

1 Like

I already tried to do that, but i can still move the camera up and down.

1 Like

In that case, you should make the camera type custom and have its position/orientation equal to the head. You can update this using renderedstep. Just make sure to disconnect once you are finished with the camera movement.

Well, how can i disconnect the function?

Well, it’s the same way when you connect a function to the event. Instead of connecting, you would call disconnect. Make sure when you connect, you create a variable for the connection so you able to disconnect later.

oh, ok, stupid word thing bruh

uhhh, why my camera are just… rotating and my roblox character is having pain??

hello, are you gonna respond me?

my roblox character is havin pain :frowning:

How are you rotating the camera?

well look my script: `local CameraEvent = game.ReplicatedStorage:WaitForChild(“CameraEvent”)
local CurrentCamera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Char = Player.Character
local Camera = false
local RunService = game:GetService(“RunService”)

CameraEvent.OnClientEvent:Connect(function(Value, CameraCFrame)
if Value == “SetCamera” then
RunService.RenderStepped:Connect(function()
local Head : BasePart = Char:FindFirstChild(“Head”)
CurrentCamera.CameraType = Enum.CameraType.Custom
CurrentCamera.CFrame = Head.CFrame
end)
elseif Value == “UnSetCamera” then

end

end)`

i’m gonna play my friends now, bye :slight_smile: