Animating fps viewmodel arms

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.

https://gyazo.com/09ad8a76ac6e4e07f645c302bca33ad4 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.

It doesn’t seem to be working but I’ve got a question

  1. I have the code attaching the motor6d in a function in a local script, the function is called whenever a number key is pressed. Would this be the problem?
local function Attach(ConnectDB)
	local ToolM6D = workspace.Motor6D  -- Find the motor6D created by server script
	ToolM6D.Parent = ViewModel.UpperTorso  -- Parent it to viewmodel torso
	local Tool = workspace.CurrentCamera:WaitForChild("ViewModel"):FindFirstChildWhichIsA("Model")
	if ConnectDB then 
		ToolM6D.Part0 = workspace.CurrentCamera:WaitForChild("ViewModel").UpperTorso
		ToolM6D.Part1 = Tool.BodyAttach
	end
	if not ConnectM6D then
		ToolM6D.Part1 = nil
	end
end

image
I think I physically died inside.
Basically if you’re using egomoose’s fps framework, you’d already have a motor6d attaching the weapon handle to the head of the viewmodel.
And if you tried to apply Headstackk’s method of animating, it wouldn’t work cause there’s two motor6d’s using the exact same parts.
Delete one of the motor6d’s and edit the animation so you’re using the same motor6d in your viewmodel. Don’t know which one to use, but I’ll try it tommorow.

hello, could you help me?
I wanted to add animations to the viewmodel but I realized that the arms were practically welded to two reference blocks found in the weapon model called left and right.
I tried to disconnect them but this led me to more problems since when disconnecting the reference blocks with my hands the viewmodel simply did not move, not even to aim and I realized something else and that is that the blocks are welded to the weapon, thus making the weapon the only thing that moves.
any way to make the view model follow the camera and also when pointing and being able to make animations without having the reference blocks?.