Replacing default Animate script with a custom one

You can write your topic however you want, but you need to answer these questions:

  1. When a character is loaded, roblox creates a LocalScript called Animate. I want to customise that system by adding different states such as crouch for example, as well as replace default idle and walk animation.

  2. I don’t know where this Animate LocalScript is coming from and I don’t know how to write over it to essentially replace it with my own script.

  3. Found some posts about how to change walk and idle animations, but these solutions don’t allow me to use my own version of the Animate script.

Here is an elaboration of why I even want to do this. Because I have crouching and proning, it’s not ideal for me that walking and idling is managed by an entirely different script. This mix up caused some unexpected behavior in my script, and the Animate script, because to Animate script the character is just standing and idle, not crouching or proning.

P.S. I have little knowledge implementing animations so if my logic is flawed please feel free to tell me

2 Likes

There are many resources that explain how to do this, but to sum up how to do this:

  1. Play the game.
  2. Copy the Animate script that ROBLOX makes. (its inside any CHARACTER in the game)
  3. Paste that into StarterCharacterScripts. (this overwrites the one that is generated)
  4. Change the actual Animation Id to yours, aswell as the one inside the script.
  5. Boom.
3 Likes

Thank you very much.
Sidenote:
I just looked over the script, there is this part

-- emote bindable hook
script:WaitForChild("PlayEmote").OnInvoke = function(emote)
	-- Only play emotes when idling
	if pose ~= "Standing" then
		return
	end
	if emoteNames[emote] ~= nil then
		-- Default emotes
		playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)

		return true, currentAnimTrack
	end

	-- Return false to indicate that the emote could not be played
	return false
end

but I couldn’t find where this bindable function is used. Do you know anything about how this bindable is used?

1 Like

Honestly, I’ve never looked through the entire thing, so im not entirely certain lol.

2 Likes

I see, anyways thank you for your help.

1 Like

of course, best of luck with your game!

1 Like

You can also copy an Animate script from a character rig and put your own animations into the animation instances to the script and in table of the script.

Yeah I saw the table and was thinking that, though I am worried about some of the things in the table. For example there is a running animation that is somehow connected to Humanoid.Running event, but I’m not even sure how the humanoid knows when it’s running. And I can’t find any specific information on this either.

1 Like

Yeah I saw that. Upping the walkspeed does not activate the Running event. You probably are better using your own script that changes the animations. That would also make things like running animations and others easier to incorporate.

1 Like

After a bit of testing it seems that running event fires when humanoid starts moving? Before I’d use Humanoid.MoveDirection ~= Vector3.new(0,0,0) but this might be a better way. It also passes the current walkspeed when the event is fired so I guess the name is just misleading, and actually represents moving.

1 Like

Awesome! Now you should be able to use that script in your games to change the animations. Good luck on your game!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.