ive been stuck on this for a while
-this is what I have
-this is what im trying to achieve
theres an aimpart on the gun; when aiming in , theres an aiming offset variable which aligns the gun sight to the middle of the players screen (by moving the viewmodel)
i have an attachment on the gun called aimAttach
right now, my offset variable moves with the gun, so you can’t see any movements or animations on the gun, since the viewmodel is orientating forwards at all times
on the bottom clip, the guns animations or movements is not limited when aiming
i’d like it to act like the bottom clip where the offset variable is counter acting or not affected by the guns movement; how could this be done?
this is the code i have, its really messy because ive been trying lots of different things
local lerpAlpha = TweenService:GetValue(indexAim, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local AIMCFRAME = CFrame.new()
if GunEquipped then
offsetTest = (offsetTest or CFrame.new()):Lerp(ViewModel.PrimaryPart.CFrame:ToObjectSpace(GunEquipped:FindFirstChild("AimAttach").WorldCFrame * CustomViewModelPosition):Inverse(), indexAim)
AIMCFRAME = AIMCFRAME * AIMCFRAME:Lerp( offsetTest , lerpAlpha)
end
local CF = workspace.CurrentCamera.CFrame * OldCamCF:Inverse()
ViewModelRoot.CFrame = (CF * AIMCFRAME * CustomViewModelPosition)