Scripting Animation Help

How would I go about replacing the original animations, or chosen ones by players? I want custom animations in my game that replaces player chosen animations, or the default animation. How could I do this?

That depends what you mean. You can change the regular animations to your own by going into the player character. Inside the player character there’s a script called Animate which has all of the main animations inside.

There’s probably an easier way of doing this tho.

I mean like replace litterally all animations with my own animations

image

Put an animation script called “Animate” (Exact spelling) inside StarterCharacterScripts. It completely overrides the player’s chosen animation pack. Then, you can change the animation id values to your own animations.

4 Likes

thats not working. Unsure whats happening

  1. Play Test on Roblox Studio
  2. Through explorer, copy the “Animate” script.
  3. Stop Test
  4. Paste the script in StarterCharacterScripts
  5. Change the animation id values VIA PROPERTY WINDOW (dont open the script)

thats exactly what I did. It did nothing

I believe you have to change the Animate script via clicking the Script itself, since the StringValues inside literally have an empty StringValue

You should find something like this:

local animNames = { 
	idle = 	{	
				{ id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
				{ id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
			},
	walk = 	{ 	
				{ id = "http://www.roblox.com/asset/?id=125749145", weight = 10 } 
			}, 
	run = 	{
				{ id = "run.xml", weight = 10 } 
			}, 
	jump = 	{
				{ id = "http://www.roblox.com/asset/?id=125750702", weight = 10 } 
			}, 
	fall = 	{
				{ id = "http://www.roblox.com/asset/?id=125750759", weight = 10 } 
			}, 
	climb = {
				{ id = "http://www.roblox.com/asset/?id=125750800", weight = 10 } 
			}, 
	toolnone = {
				{ id = "http://www.roblox.com/asset/?id=125750867", weight = 10 } 
			},
	toolslash = {
				{ id = "http://www.roblox.com/asset/?id=129967390", weight = 10 } 
--				{ id = "slash.xml", weight = 10 } 
			},
	toollunge = {
				{ id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } 
			},
	wave = {
				{ id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } 
			},
	point = {
				{ id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } 
			},
	dance = {
				{ id = "http://www.roblox.com/asset/?id=130018893", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=132546839", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=132546884", weight = 10 } 
			},
	dance2 = {
				{ id = "http://www.roblox.com/asset/?id=160934142", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934298", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934376", weight = 10 } 
			},
	dance3 = {
				{ id = "http://www.roblox.com/asset/?id=160934458", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934530", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934593", weight = 10 } 
			},
	laugh = {
				{ id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } 
			},
	cheer = {
				{ id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } 
			},
}

I found it. Do I change those values?

Yeah, change the id = http://www.roblox.com/asset/?id=09140491203914 to your Animation ID and it should work?

HEYY! It does thank you! Very helpful. :slight_smile:

How can I change the animation if I press shift? And when I let go of shift how can It change back to before?

You could just set the Animate’s run StringValue inside a different script? You’ll have to configure around with the script yourself via UserInputService, and defining what ID’s you want to replace when you press/release the Shift key

my script is this,

local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local PLR = game.Players.LocalPlayer

UIS.InputBegan:Connect(function(KeyCode)
	if KeyCode.KeyCode == Enum.KeyCode.LeftShift then
		
		script.Parent.Animate.run.Value = "rbxassetid://6323967087"
		script.Parent.Animate.run.RunAnim.AnimationId = "rbxassetid://6323967087"
		
		script.Parent.Animate.walk.Value = "rbxassetid://6323967087"
		script.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://6323967087"
		
		TS:Create(
			script.Parent:WaitForChild("Humanoid"),
			TweenInfo.new(
				0.5,
				Enum.EasingStyle.Linear
			),
			{
				WalkSpeed = 20;
			}
		):Play()
	end
end)

UIS.InputEnded:Connect(function(KeyCode)
	if KeyCode.KeyCode == Enum.KeyCode.LeftShift then
		TS:Create(
			script.Parent:WaitForChild("Humanoid"),
			TweenInfo.new(
				0.5,
				Enum.EasingStyle.Linear
			),
			{
				WalkSpeed = 11;
			}
		):Play()
	end
end)

The speed up part works, but it doesnt change the animation

Are you wanting to change back the walk animation to the default when you release the Shift key?

No, I want it to change to another animation I made. Not the default

Can’t you just do what I referenced earlier? Both of your value changes are trying to set it to the same ID, unless if you want to implement a run Animation

You could just also try creating an Animation to play it that way

local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local PLR = game.Players.LocalPlayer
local Character = PLR.Character or PLR.CharacterAdded:Wait()
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://6323967087"
Animation.Parent = Character

local LoadAnimation = Animator:LoadAnimation(Animation)

UIS.InputBegan:Connect(function(KeyCode)
	if KeyCode.KeyCode == Enum.KeyCode.LeftShift then
		LoadAnimation:Play()
		--script.Parent.Animate.run.Value = "rbxassetid://6323967087"
		--script.Parent.Animate.run.RunAnim.AnimationId = "rbxassetid://6323967087"
		
		--script.Parent.Animate.walk.Value = "rbxassetid://6323967087"
		--script.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://6323967087"
		
		TS:Create(
			script.Parent:WaitForChild("Humanoid"),
			TweenInfo.new(
				0.5,
				Enum.EasingStyle.Linear
			),
			{
				Humanoid.WalkSpeed = 20;
			}
		):Play()
	end
end)

UIS.InputEnded:Connect(function(KeyCode)
	if KeyCode.KeyCode == Enum.KeyCode.LeftShift then
		LoadAnimation:Stop()
		TS:Create(
			script.Parent:WaitForChild("Humanoid"),
			TweenInfo.new(
				0.5,
				Enum.EasingStyle.Linear
			),
			{
				Humanoid.WalkSpeed = 11;
			}
		):Play()
	end
end)

I tried that. It bugs out because whenever I jump, it stays in the running animation which looks weird.

This may be because of how the jump animations priority is intercepting with the running animations priority, try messing around with the priority when animating