I am trying to force players in my game to use certain movement animations (e.g. walk, run). I’ve been trying to do this for about 2 hours now to no avail. The roblox game settings menu conveniently lets you override character scale and clothing, but not animations.
In the past I’ve fixed this by inserting a forked version of the animate script into StarterCharacterScripts, but as of recently It’s gotten harder.
I am currently using game settings set to standard animations, with my own edited animation script (its the default roblox one but with my own id’s inserted). I’ve encountered bizarre behaviors like:
the run animation only playing on the client, while all other animations replicate just fine
the walk animation wont play when the other player is walking, but when you nudge/push the other player it plays???
I am very confused, does anyone know any easy fixes to this?
As you can see, in the first clip the other player’s walk animation wasn’t replicating (it was only displaying client-side) and yet in the second clip, the walk animation did replicate, but only when the player was nudged/pushed!!
If I don’t get any solutions I’ll make a bug report.
As you can see below, it only lets you use default R15 animations or let the player use their own animation packs, but it does not allow you to force your own animations.
You also don’t need to fork the Animate script - you in fact should not if your only intention is to change which animations a player is using. Roblox specifically released a feature that you can use to your advantage for quick avatar changes, HumanoidDescription. Get the character’s current one, change the animations and apply it.
local humanoid = somewhereSomething
local currentDescription = humanoid:GetAppliedDescription()
-- Only the numbers; do not include any rbxassetid or anything
currentDescription.RunAnimation = someID
currentDescription.WalkAnimation = someIDButNotTheSameAsTheAbove
humanoid:ApplyDescription(currentDescription)
If you want to use custom animations with HumanoidDescriptions, you also need to follow the setup Roblox has when it uploads avatar animations to the site. HumanoidDescriptions adhere to a very explicit loading pattern that you must replicate. To do so: create a folder, stuff your animation in and upload it as a model to the site, then use that model id for either of the animation fields.
Valid animation names are anything you find under the Animate script inside those value objects. For example, if you wanted to upload a walk animation, this is how your hierarchy should look like:
<Folder> R15Anim
<StringValue> walk
<Animation> RunAnim
I didn’t see that reply, and it fixed my problem. However, I am hesitant to use the HumanoidDescription method because of mobile and console users. The Walk animation only displays for mobile and console users. In my use case, I am using the Rthro walk animation as the run animation AND the walk animation because I want the animation to be the same when mobile/console users slow down and the walk animation plays. If I have different animation ID for walk it could look weird visually for mobile and console users. Regardless, the process that you just described seems unnecessarily complicated. Why doesn’t Roblox just use normal animation ID’s?
Is there a way to adjust animation weight via HumanoidDescription?
It depends on how you look at it. The process I described isn’t complicated at all. It’s a few lines of code plus an extra tidbit if you’re looking to support custom animations. Forking should always be reserved for when you make more major script edits or structure changes that you can’t achieve natively.
Roblox still uses normal animation ids, it’s just future-proofed to be compatible with all rig constructs, hence the folder R15Anim and then a child object. I don’t quite understand what the point of making ValueObject containers is still, haven’t quite looked into that.
Animation weight cannot be adjusted via HumanoidDescription, you’ll have to do it how Roblox does it. You would have to create a NumberValue in the animation object called Weight and change it from there. So if you were working with custom animations, it’d be the same hierarchy as what I mentioned except with a Weight NumberValue inside the animation.
With respect to the fact that you’re working with default Roblox animations, a lot of the content of each of my replies can be ignored and just stored for future reference. You will have to fork the Animate script for this. Specifically, you’ll want to remove the bits of the script that blend the run and walk animations.