I’m trying to make it so when aiming boolvalue is true then the viewmodel will aim
issue is that when i set the cframe and everything then the gun just dissappears when i hold mouse left button
i searched and looked at many posts but none of that works for me
here is my code:
— the part where the vm gets to camera —
vm:SetPrimaryPartCFrame(camera.CFrame
* CFrame.Angles(sway.y,-sway.x,-sway.x)
* CFrame.Angles(0,0,strafing.z)
* CFrame.new(walk.x,walk.y,walk.z)
* Offset
* aimCFrame)
— the offset cframe script that is under the if aminig true thing —
if Aiming then
local Dist = Camera.CFrame:ToObjectSpace(vm.AimPart.CFrame)
aimCFrame = CFrame.new(0,-1.3,0)
Offset=CFrame.new(Dist.X,Dist.Y,0)
else
aimCFrame = CFrame.new()
Offset = CFrame.new()
end
for cframing things like viewmodels I would suggest printing their final cframe on update, as its probably not dissapearing, its probably being set to NaN, NaN, NaN or being set really far away due to goofy ahh cframe math
edit: also whats the difference between aimCFrame and Offset? they look like they are achieving essentially the same thing except one’s moving it to the AimPart and one’s moving it 1.3 studs upwards
Okay i tried it and the CFrame was flying around random numbers (sometimes the first number was 1345 and a half second after it was -59614), but how does other fps games aiming work? i mean i have no idea how to make it aim without flying away