I need to animate a model that is attached to a character as an accessory.
I searched the DevForum for answers and found two posts by @MapleMarvel, the first one being problems with AnimationControllers not replicating to other clients and the second being how to run animations without Humanoids or AnimationControllers.
Either you can take the long route and create a custom animation system that utilises the CFrame properties of JointInstances, or you can use an animation editing plugin and create an animation using Humanoids or AnimationControllers (which in itself requires Motor6Ds, a class that inherits from JointInstances and operates using CFrames).
Without a custom implementation or animation objects, you can’t “animate” accessories.
You can still animate models welded to characters using animation plugins, just saying.
The most common way is to have a weld part, which serves as the root (or PrimaryPart) of the model. This weld part is an invisible copy of a character limb which you intend to weld something to. All your parts should be welded to this weld part and the weld part should be welded to the limb in question. The model should be a descendant of the character.
The Scripting Support category is not a venue to ask for code so I can’t provide you any implementations, though I can offer you advice as to where to go - which you’ve pretty much answered for yourself. In any standard environment where you’d usually weld a model to a character, just incorporate that into your CharacterAdded event.
Connect to CharacterAdded
Clone the pre-welded model (if you don’t need the model modified at run time, you should always strive to pre-weld objects rather than do so at run time via weld scripts)
Parent the cloned item as a child to the character
Weld the WeldPart to the limb you want the accessory attached to
Set the NetworkOwnership of any BasePart descendants to the client via Model.GetDescendants (I often forget network ownership myself, though now with experimental mode gone, network ownership sets are important)
To put it into perspective, I’ve come up with a quick repro in Studio that demonstrates the object hierarchy and such. Have a look.
All unanchored parts are physically simulated on Roblox. Network ownership pertains to which environment is responsible for calculating physics; the server or the client. To minimise the server workload and allow for immediate client feedback, you would normally assign the client as the network owner of a part and therefore the one calculating its physics. Characters are network owned by the client which is why you’ll notice that there’s no delays when you’re moving around.
I’m not quite sure what you can do with my place file since it’s merely a visual demonstration of how the assembly should appear, but I can provide it to you if you’re able to salvage it or use it as a guideline for your own use cases, I suppose.
Do you have any plugins that can be used to achieve this? Is extra scripting required to accomplish this?
I have a model that gets welded to the player’s hand and need to make it so that I can animate it. It’s a sword and I’m trying to animate a throw mechanic, and im not sure if I should replace the weld with a Motor6D
If you want to be able to animate parts using Roblox animations, you will need to use Motor6Ds. If not, then you’d have to write your own code to handle movement or anything else you want.
Ever since figuring out the formula for welding (I don’t really understand it myself but I’ve memorised it), I don’t use plugins for any welding, only for animating. I’m not sure which part specifically you were looking for a plugin on, but if it’s welding then yeah I do that myself via the command bar nowadays.
If you’re using animations then yes, you still do. Animations rely on manipulating the Transform property of Motor6Ds in order to make things work. That being said, if you’re using Roblox animations then your model also needs an AnimationController in order to load the animation for the model and that’s out of the scope of the original thread which is about animating models without Roblox animations. You should create a new thread if you have a different problem you want to try resolving.
There’s an hacky way to do this, I personally animated a SkinnedMesh through the use of Motor6D to the head or the mesh with an AnimationController, then converted it into an accessory live in game, which still played the animation flawlessly (through the accessory object attached to an Humanoid).
Roblox seems to be play animations with a very rigid instance based method that ignores such things, good for us.
Which means this is 100% possible but surely unintended, which is a shame considering the potential is great.