Hello everybody! I’m Headstackk, I’ve been creating and making weapons on Roblox for a while. Today I’m going to teach you how to animate a weapon tool.
I have already briefly explain how on this DevForum post, but I’d like to make a new post to clarify everything and explain it step by step.
In most of the Roblox Shooter games (Excluding advanced shooter games such as Phantom Forces), I observed that they usually make a really simple animation, not even detached magazine, or moving bolt. In this tutorial, I’m going to teach you how to animate those details.
If you would like to make a really detailed gun in terms of Animations and details, be sure to follow this tutorial!
In the end of this tutorial, you should be able to create something like this:
So, let’s begin!
I will use a M16 Assult Rifle that I built as an example this time.
1: Create an animating Dummy:
2: Group your gun model, and put it inside the dummy. Your gun model should be parented to the Dummy.
3: Create a new part, name it BodyAttach and place it at wherever you want to, I recommend you to put it near the Gun Handle.
Do Not name the part as Handle.
Inside, you can put cosmetics such as Gun Sounds, Flash Light etc.
4: Connect all the parts of your guns to BodyAttach with Motor6D.
Before we proceed, you have to install this plugin
It’s a must have plugin when it comes to Motor6Ds and Weld.
After installing it, you will need it to connect all the parts.
Please be sure that all the parts are unanchored and there are no welds.
First, select the BodyAttach part first, then select the rest.
After selecting all the parts, click “New Motor6D” in the plugin tab.
And that’s it! You connect all the parts in your gun with Motor6D, they will now stick together.
But before animating, we have to stick the Motor6D to the Animating Dummy!
5: Connecting the dummy to the gun:
For this step, we do not need to use the plugin. Instead, manually create a new Motor6D, you can create one by typing the command in the output bar:
Make sure that the Command Bar is on.
Then, put the Motor6D into the Dummy’s Torso.
After that, Connect the Motor6D’s Part0 as the dummy’s Torso, and connect it’s Part1 to the BodyAttach of your gun. Make sure your gun is NOT ANCHORED when doing this!
Last but not least, WOAH! You will realize your gun moved. Don’t worry, that’s an expected behavior. DO NOT move or rotate your gun after this step, or else the Motor6D will be disconnected!
6: Finally! You can start animating!
Open the Roblox Animation Editor, then you can start animating!
You might find something different, when you move the Right Arm, the Gun doesn’t move. This is because your weapon is connected to the Torso instead of Right Arm, like a legacy Roblox tool does.
Benefits of this:
The advantage of connecting to Torso instead of Right Arm is you can animate the gun freely instead of sticking to the Right Arm all the time.
Reloading with right arm
And more! You can also animate knife tricks animation with this, without the knife being stick to the Right Arm all the time.
However, in this tutorial, I’m not going to teach how to animate the gun since I’m also a Junior animator, but that’s how you animate details of a gun!
7: Essential part: In game
You will find this not working in game if you just put it as a typical tool, there are few steps to do before you put it into the game, which requires some scripting.
While animating it, the dummy’s torso is attached to BodyAttach, so does a player character do! You have to create a Motor6D to connect Player’s Character’s Torso manually when tool is being equipped, and destroy it when tool is being unequipped. This has to be done in Server, but you can perform it on Client first before the server for better visual effects.
Remember to implement a RemoteEvent in ReplicatedStorage. I name the Connect M6D and Disonnect M6D RemoteEvent
I also create the Motor6D inside the Torso when CharacterAdded.
Client script inside the gun tool:
script.Parent.Equipped:Connect(function() game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.BodyAttach) char.Torso.ToolGrip.Part0 = char.Torso char.Torso.ToolGrip.Part1 = WeaponTool.BodyAttach end) WeaponTool.Unequipped:Connect(function() game.ReplicatedStorage.DisconnectM6D:FireServer() end)
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) local M6D = Instance.new("Motor6D", char.Torso) M6D.Name = "ToolGrip" end) end) game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location) local char = plr.Character char.Torso.ToolGrip.Part0 = char.Torso char.Torso.ToolGrip.Part1 = location end) game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr) plr.Character.Torso.ToolGrip.Part1 = nil end)
LAST, LAST BUT NOT LEAST! Remember to DISABLE RequireHandle in the tool!
That’s all about it! If you have any problem, feel free to reply and I’ll be glad to assist you
My aplogies for such a rushed tutorial, I might add more information when necessary.
Happy animating guns… I guess?
Here’s the completed animation of the M16!
EDIT: IMPORTANT NOTICE:
Apparently, your part can not be named as “MeshPart”. This will happen if you attempt to:
You won’t able to animate that part if it’s name is “MeshPart” with the Default Roblox Animator. No idea why it happens.
Yes, obviously this is exploitable. Because someone actually wrote an exploit script for this lol. It can easily be exploited by cheaters mainly with the Remote Event “ConnectM6D”
I recommend doing server checks, when the Remote Event is being received, check whether the part is valid (is it inside a tool? is it a descendant of player’s character?) etc.
Sorry for not responding to the questions raised in this thread, I’ll try to make a video and explain it in detail soon if I have time.