How would I go about implementing a system similar to the jailbreak gun system, in which the character’s upper body orients itself to look at the mouse.hit position? Sorry for the vague and unspecific question, but I’m not sure where I could really start with this. Any help would be much appreciated
This basically uses the core mechanics of the good old roblox shiftlock, here is a simple example how you could replicate this, place this accordingly the runservice event for whenever you want to activate it
local runservice = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local playerCharacter = player.Character or player.CharacterAdded:Wait()
local currentCam = workspace.CurrentCamera
runservice.RenderStepped:Connect(function(deltaTime)
userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
playerCharacter.HumanoidRootPart.CFrame = CFrame.lookAt(playerCharacter.HumanoidRootPart.Position, Vector3.new(2 * playerCharacter.HumanoidRootPart.Position.X - currentCam.CFrame.Position.X, playerCharacter.HumanoidRootPart.Position.Y, 2 * playerCharacter.HumanoidRootPart.Position.Z - currentCam.CFrame.Position.Z)) -- Alligning the rootpart to look at the front with the z axis and x axis
currentCam.CFrame = currentCam.CFrame * CFrame.new(2, .2, 1) -- The camera offset
end)
This must be a local script
Correcting myself, I just red you only want the upperbody. Well you’d have have to use some math on the according motor6d under it