Animating fps viewmodel arms

TLDR: The tools wont move with the arms

I’m trying to apply Headstackk’s method of animating tools to an fps viewmodel, but I’m at a loss on how to make it work. For starters, I can’t attach the motor6d through a server script (Example from tutorial: https://gyazo.com/c041b0dbb62fc214ac288b0efa455951) as the server can’t access the viewmodel which is placed in the clients camera.
Any pointers would be appreciated.

1 Like

Bumping the post, still looking for an answer

If you can’t attach the motor6d through a server script, can’t you just attach it in a client script? The reason why you can’t attach through a server script is because the ViewModel is supposed to be only visible to you, or local.

Right, I though of that myself as well.
So I moved the code from the server script into a function which would be called whenever a number key is pressed.
This just didn’t work, the m6d was attached to the bodyattach part and all, but it just didn’t work the tool wouldn’t move with the animation.

Here’s what I tried in a local script

local function Attach(ConnectDB)
	local M6D = player.Character.Head:FindFirstChild("VM_ToolM6D") 
	M6D.Parent = ViewModel.UpperTorso  -- Move the m6d from character head to viewmodel torso
	local Tool = ViewModel:FindFirstChildWhichIsA("Model")  -- Tool is the model placed in viewmodel
	if ConnectDB then  -- If trying to connect the db
		M6D.Part0 = ViewModel.UpperTorso
		M6D.Part1 = Tool.BodyAttach
	end
	if not ConnectM6D then
		M6D.Part1 = nil
	end
end

Are there any errors in the output?

Nope, animation plays fine however the model is not going along with the arm animations.
https://gyazo.com/92dc82a51bfc112e66b142b7dacb30ce

Might be an unpopular opinion but if you’re dealing with first person combat I would highly recommend you to NOT use tools. First person controller viewmodels are almost always completely independent from your character’s body and using tools will only bring you problems.

Except I’m not using tools, I’m using a model, I suppose these two act in completely different ways when it comes to animation?
image

Interesting how you’re doing it. I always make every element of my viewmodels anchored and only move the model by :SetPrimaryPartCFrame() and animation utilizing AnimationController rather than humanoid.

Right so Headstackk’s method of animating tools is only specifically for tools then?
Anyway, how would I go about animating my viewmodel and tool model?

As far as I can tell it is just for tools. I use the Rig Editor plugin which allows animations with just an AnimationController. Never had to use scripts to place or modify Motor6D’s. You shouldn’t have to do that either. All the code you need is for positioning your viewmodel and triggering animations.

And how would I go about rigging the tool model to the viewmodel?
And is there any reason why I shouldn’t use a tool in this situation, what problems could there be?

Bumping. Still unsure if I’m supposed to be even using headstackk’s method.

Headstackk’s method is to connect the gun to the torso of the character.

The tool don’t matter, it’s just used to create the Motor6D connection when you enable and select the tool and to replicate it to other players as well.

However this goes against your method of using a client sided view model and having the sword connected to the arm as it’s an entirely separate view model. Ultimately it’s up to you, connect the sword to the viewmodel or connect it to the character.

Right, but my original problem was that using headstackk’s method to animate the viewmodel doesn’t work, the “tool” model doesn’t move along with the rest of the animation, despite being attached to the uppertorso with a motor6d.
Should I be doing something else? You say its left up to me to decided, but I dont know what to do.

Let me clear things up a bit.

There are 2 things you need to animate since you are using the Roblox animate method.

  1. You need to animate the character, this is what everyone else will see. This is done by attaching the gun to the torso of the character with the Motor6D and what Headstackk does in the tutorial. Why a torso? It’s explained in the tutorial.

This is also what EgoMoose does for his FPS tutorial to which he explains the reason why:

If you notice both the gun and the character are present in the same animation. That’s because they are both connected.

  1. The second thing you will need to animate is the first person view model.

For an FPS Game this is usually done via Motor6D C0 CFrames instead of default animation though you can mix the two. Why use CFrames? So you can do CFrame math to place the crosshair and stuff directly in front of the camera and have proper right aiming. Also you can do other cool stuff like spring shoving math to emulate gun recoil.

No one else will see this first person view model as EgoMoose laments:

But yeah thats how it goes from what I know. Hope it clears things up.

Edit: Even though these are two separate things I believe there are other tricks they use like view model standardization to reuse animations from the third person gunmodel and the first person one.

I believe I have found the trick made by @colbert2677 to replicate the third person viewmodel to a first person one in order to reuse animations, after further research I advise @amadeupworld2 to do too:

Using Headstackk’s method combined with egomooses fps tutorial, I am trying to animate the viewmodel.
https://gyazo.com/2655b130f487f8a5dc3d40e0ae9ce278
However, the problem is the tool model is not moving with the arm animations as shown in the video.
What I’d very much prefer not to do is completely scrap the viewmodel I have already created.

How does the animation screen look like when you try to animate the viewmodel? You should be able to move the sword around in the animation screen.

Screen capture - 09ad8a76ac6e4e07f645c302bca33ad4 - Gyazo That works fine.

Make sure the Part0 name , Part1 name, and Motor6D name is the same you used in the animation rig as the one you created for the view model or else the animations won’t apply.

TBH, it’s really hard to debug these sorts of questions. Heavily relies on how it was rigged, the code, and how the animation was made two of which we cannot access with unless the model is shared though its your choice.