Character glitches and jitters back and forth when in third person?

Greetings fellow scriptwriters, I’ve been trying to nail this for a while, and my previous thread didn’t work at all, and rather than necrobumping it I want to give more clarity on this one into the issue and also show what I’ve done so far.

So I am essentially making a third person shooter. Think of the camera like how Fortnite works, or ShiftLock. You see over your shoulder, and you’re in third person, but your character rotates with the camera as if you are in third person.

For whatever reason, Roblox doesn’t have the API to help you force ShiftLock, so if you want such a feature forced then you have to script it yourself.

I saw this as no biggie and followed a quick tutorial as my script wasn’t working:
This script is in StarterCharacterScripts

local runService = game:GetService("RunService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local humanoid = player.Character.Humanoid

local runService = game:GetService('RunService')
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local character = player.Character or player.CharacterAdded:Wait()
     humanoid.CameraOffset = Vector3.new(2.5,0.5,2)

I was stumbled as to why this hadn’t been working, and then I realized you also have to also configure the camera module to enable if the mouse is locked to the player. This is scripted under CameraModule:Update(dt) in the CameraModule script

function CameraModule:Update(dt)
	if self.activeCameraController then
		if game.Players.LocalPlayer.PlayerScripts.ShiftLockToggle.ShiftLockToggle.Value == true then
			self.activeCameraController:SetIsMouseLocked(true)
			
		else
            self.activeCameraController:SetIsMouseLocked(false)
		end

And now the script works fine. Whenever the players are in the game and not the lobby, I set the ShiftLockToggle to true and set the CameraType to Follow, and finally I switch the camera Subject from the Lobby Camera Part to the player’s humanoid.

The camera technically works just as it’s supposed to, but it’s… laggy? Whenever the player moves, it’s fine. The only lag occurs when you are moving the camera, or for some reason, if you move while jumping. Here is a clip of what’s going on:

One of the things I had tried was using RenderStep, I would switch the camera’s CFrame to the Torso’s CFrame and adjust for the offset for being over the shoulder. This worked, except you can’t turn the camera as CFrame includes orientation.

Someone mind helping?

2 Likes