Hello!
For a long time I’ve been handing aiming with a set offset. Although now, I decided I’ll try going with an aiming part so I won’t have to test and recorect the cframe everytime to get it correct.
I ended up with this script that makes my gun rotates everywhere :
if not self.viewmodel then return end
local start = self.viewmodel.AimPart.CFrame
local ending = workspace.CurrentCamera:ScreenPointToRay(mouse.ViewSizeX/2, mouse.ViewSizeY/2, 1);
local cf = CFrame.new(ending.Origin, ending.Direction)
self.offsets.aim = self.offsets.aim:lerp(cf:ToObjectSpace(start), self.lerpValues.aim.Value)
self.viewmodel.GripPart.CFrame = self.camera.CFrame
self.viewmodel.GripPart.CFrame *= self.offsets.idle
self.viewmodel.GripPart.CFrame *= self.offsets.aim
Thank you!