How can i change this camera position?

I was given a script whereas the camera is fixed and the player cant rotate it or zoom, but the position of the camera is not where i want it to be


this is where it is

this is what i want it to look like

local RS = game:GetService("RunService")
local PLS = game:GetService("Players")

local Client = PLS.LocalPlayer
local Character = Client.Character or Client.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")

local Camera = workspace.CurrentCamera

local Offset = Vector3.new(0, 10, 15) -- Modify it to your needs.

Camera:GetPropertyChangedSignal("CameraType"):Connect(function()
	Camera.CameraType = Enum.CameraType.Scriptable
end)

Camera.CameraType = Enum.CameraType.Scriptable

RS.RenderStepped:Connect(function()
	Camera.CFrame = CFrame.lookAt(HRP.Position + Offset, HRP.Position)
end)

this is the script thats in starter character script
how can i change the cameras position to make it like the second photo?

1 Like

I think you change the offset.

1 Like

For the CFrame.Lookat, why not just do this?

offset = Vector3.new(0,10,0)
CFrame.lookAt(HRP.Position + (-HRP.CFrame.LookVector * 15) + offset, HRP.Position)
1 Like

i tried the script and it works, although i doesnt really work how i want it to be

robloxapp-20240902-1849589.wmv (1.2 MB)
this is what happens when i move around (the camera is moving with the player)
robloxapp-20240902-1852178.wmv (676.9 KB)
this is what i want the happen (the camera stays in place)
how can i make the camera fixed instead of moving with the player?

1 Like

Just set the cframe once, outside of the render stepped

1 Like


would it be like this?
i tried the script and it made the camera in one place
robloxapp-20240902-1936112.wmv (301.9 KB)

1 Like

That seems to be what you asked for right? Or it is something else?

Sorry for the late response, i want the camera to be unable to zoom and rotate but only face in one direction, and i mean like, the camera should move with the player but no matter what direction the player goes the camera stays facing one direction, i kind of misphrased what i wanted before

You need to determine offset you want
local offset = Vector3.new(20, 0, 0)

in RenderStepped
Camera CFrame = CFrame.new(character.CFrame.Position + offset, character.CFrame.Position)

Camera will now face player towards the negative X axis in world space

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.