I was making a gun system using securecast, but I ran into an issue. I’m using a viewport gun - I clone the tool with the primary part set to an aimpart, then PivotTo it to the camera at each new frame. Separately, I have a character that only has a transparent torso and hands that I also move to the camera to act as viewport hands. I was able to play the gun reload animations on the arms and aim and then unaim the gun by tweening a vector3 value that acts as an offset.
However I ran into a problem - I don’t know how to play the same animation on the viewport gun that I play on the actual gun.
I know that ACS just has two separate animations for the server and viewport, however I don’t want to animate the same thing twice.
Has anyone else who has made their gun system with aiming ran into this sort of issue? How did you solve it? Thank you.
not what i meant, im not using viewport frames, the gun tool clone exists but only clientside and is pinned to the camera, which is why i called it a viewport gun
Because to aim the gun I need to have it positioned exactly at the camera (gun’s primary part is an aimpart, so when it is at the camera’s position aiming happens), and to unaim it i use an offset vector3value
After weeks of trying to find the solution for this, I came up with this method:
Clone a character from replicated storage that only has a humanoid with an animator, a torso and left and right arms and the corresponding motor6ds to link them. Later referred to as viewport arms.
Clone the gun tool, parent it to the viewport arms.
Set the viewport arms PrimaryPart to the gun’s aim part
Disable the RightGrip weld under the right arm of the viewport arms and replace it with a motor6d
At every render step, move the arms to the camera position + a vector3value offset
When aiming, tween the offset to zero. Since the primary part of the arms is set to the gun’s aimpart, when the offset is zero the gun is in the aiming position.
When unaiming, set the offset to the value you prefer, for me it is something along the lines of (0.5,-0.5,0.7)
Play the same animations that you play on the player’s character on the viewport arms.