Shoulder Camear Won't Stay In Correct Position

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?

I am trying to have a shoulder camera where the camera stays put off the players shoulder and focuses on a part.

  1. What is the issue? Include screenshots / videos if possible!

The camera not only doesn’t stay in place to the players torso with the offset, the player is able to walk away out of view.

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local player = Players.LocalPlayer


character = player.CharacterAdded:Wait()


while true do
	workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
	task.wait()
    local lockon =character:WaitForChild("UpperTorso").Position+ Vector3.new(-.5,2,-10)
	camera.CFrame = CFrame.new(lockon , workspace.aiming.Position)
	UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
end

-- 

I am not sure why the camera isn’t staying according to where I put the cframe with the offset.

External Media

Can you send some footage so i know what you are talking about?

Yes I just uploaded I forgot to do that at first should be at the end now

We have to make some adjustments first, change while true do to game[“Run Service”].RenderStepped, which is way better, try fiddling around with the position and offset, stuff like that, currently I have to go, try the things I said above and if you dont find a solution, maybe refer to a roblox developer discord server to help you.

1 Like

yeah been trying that will keep trying thanks

local Game = game
local Workspace = workspace
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = Workspace.CurrentCamera
local offset = Vector3.new()
local rootPart = Character:WaitForChild("UpperTorso")


local function OnRenderStep()
	local part = workspace.aiming
	local char =  Character
	local charCF = char:GetPrimaryPartCFrame()
	local direction = ((part.Position - charCF.Position) * Vector3.new(1,0,1)) + Vector3.new(0, charCF.Position.Y,0)
	local newCF = CFrame.lookAt(charCF.Position, charCF.Position + direction, Vector3.new(0,1,0))
	char:SetPrimaryPartCFrame(newCF)
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = CFrame.new(Character:GetPivot() *Vector3.new(2, 4, 13), workspace.aiming.Position)   
end



RunService.RenderStepped:Connect(OnRenderStep)


Fixed after trying some other things.

https://streamable.com/8neb4w

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