Im trying to make aiming down sights for my gun system using attachment for the viewmodel offset.
My code for ViewModel offset:
local add = CFrame.new()
if tool then
for i, val in pairs(tool:GetChildren()) do
if val:IsA("CFrameValue") and string.find(val.Name, "_OFFSET") then
add*=val.Value
end
end
end
local originalcf = workspace.CurrentCamera.CFrame * add * CFrame.new(0, -2, 0) * JointM6D.Transform
Values in the tool:
For aiming im just tweening the AIM_OFFSET value with this formula:
local aimincf = AimAttachment.WorldCFrame:ToObjectSpace(Camera.CFrame)
It gives me a minor offset like this:
Its getting fixed when i remove the FP_OFFSET value COMPLETELY, the FP_OFFSET value is too big compared to the offset it gives me so i can’t understand what makes it happen
Result after i remove FP_OFFSET value from the tool completely: