The character UpperTorso does not follow the mouse well

  1. What do you want to achieve? Keep it simple and clear!
    I want the UpperTorso to rotate towards the mouse for my weapon system, I want to make it similar to jailbreak.

  2. What is the issue? Include screenshots / videos if possible!
    When the mouse is pointing down the UpperTorso looks up
    robloxapp-20201230-1457378.wmv (1,2 MB)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have googled to see if I found a similar topic in the forum but I have not found anything related.

The code I use is similar to this only that I have passed it all to the client

Here is the game: UpperTorsoTurnToMouse.rbxl (21,5 KB)

If you are using a code similar to the post you linked then you will need to add a rotational offset because off the nature of the C0 joint being relative to the part 0 of the Motor6D.

function answears(plr,look) 
local rootCFrame = HumanoidRootPart.CFrame;--make sure to get your humanoid root part
local rotationOffset = (rootCFrame - rootCFrame.p):inverse();
--Gotta add this rotation offset first to make the c0 look in world terms
	waist.C0 = rotationOffset*,* 100)/100,math.floor(look.Y * 100)/100,math.floor(look.Z * 100)/100))

I’ve done what you said and it’s still wrong

Eh, then it must be something wrong with the code the other guy posted. TBH I don’t really understand his math.floor method so I will use my own method introducing my own resource [Insert Shameless advertising]

Now you can add constraints in the form of angles so it looks more realistic

New script using my module
local camera = workspace.CurrentCamera
local mouse = game.Players.LocalPlayer:GetMouse()

local waistConstraints = {
	["YawLeft"] = 45;
	["YawRight"] = 45;
	["ElevationAngle"] = 45;
	["DepressionAngle"] = 45;

local TurretController = require(script.TurretController)

	local char = game.Players.LocalPlayer.Character if not char then return end
	local UpperTorso = char:FindFirstChild("UpperTorso") if not UpperTorso then return end
	local waist = UpperTorso:FindFirstChild("Waist") if not waist then return end

	local mouseUnitRay = camera:ScreenPointToRay(mouse.X, mouse.Y)
	local mouseRay =, mouseUnitRay.Direction * 500)
	local target, hit = workspace:FindPartOnRay(mouseRay, mouse.TargetFilter)
	local waistController =,waistConstraints)

And here is the place file. Keep in mind my current implementation is glitchy if the player looks straight down. Also instead of always checking if the character has a waist, you can probably just either use StarterCharacter scripts or use the character added event so it’s less laggy to avoid doing this:


every renderstep, you can just do a Character:WaitForChild(“UpperTorso”) with the character added event. Also it’s a good idea to instantiate my turret controller object only once rather than creating it every renderstep which I did currently due to convenience reasons with your current code setup. Just keep this in mind next time and for other people reading this and planning to use this method.

DtheUpperTorsoTurnToMouse.rbxl (24.7 KB)