Problem with animations not playing

Alright, so I’ve been making a little thing that plays animations, but when it plays an animation, or attempts to, for moving in the forward-right direction. It breaks all movement animations. Is there a way to get it to work?

I’m using a custom 9-part rig(r9)

Video

here is my code:

local RunService = game:GetService("RunService")

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Human = script.Parent:WaitForChild("Humanoid")
local Root = Char:WaitForChild("HumanoidRootPart")

local idle = Human:LoadAnimation(Animations.Idle)
local fw = Human:LoadAnimation(Animations.WalkForward)
local fwr = Human:LoadAnimation(Animations.WalkForwardRight)
fw:Play()
fwr:Play()
idle:Play()

local animDir = "idle"

local easingTime = 0.1


RunService.RenderStepped:Connect(function()
	local Direction = Root.CFrame:VectorToObjectSpace(Human.MoveDirection)
	local animPlay = false
	print(Direction)
	--print(Momentum)
	idle:AdjustWeight(10)
	if Direction.Z > 0.9 then
		animPlay = true
		idle:AdjustWeight(0)
		if animDir ~= "back" then
			animDir = "back"
			fw:AdjustSpeed(-1, easingTime)
			fwr:AdjustWeight(0 ,easingTime)
			fw:AdjustWeight(10, easingTime)
		end
	end
	if Direction.Z < -0.9 then
		animPlay = true
		idle:AdjustWeight(0)
		if animDir ~= "front" then
			animDir = "front"
			fw:AdjustSpeed(1, easingTime)
			fwr:AdjustWeight(0 ,easingTime)
			fw:AdjustWeight(10 ,easingTime)
		end
	end
	if Direction.Z < -0.5 and Direction.X > 0.5  then --This one breaks the script when
		animPlay = true
		idle:AdjustWeight(0)
		if animDir ~= "frontR" then
			animDir = "frontR"
			fw:AdjustWeight(0 ,easingTime)
			fwr:AdjustSpeed(1.41, easingTime)
			fwr:AdjustWeight(10 ,easingTime)
		end
	end
	if animPlay == false then
		animDir = "idle"
		fw:AdjustWeight(0, easingTime)
		fwr:AdjustWeight(0 ,easingTime)
		idle:AdjustWeight(10, easingTime)
	end
end)```
1 Like

The issue might stems from the fact you are loading the animations on the Humanoid, not the Animator.

local Player = game.Players.LocalPlayer
local Char = script.Parent
local Human = Char:WaitForChild("Humanoid")
local Root = Char:WaitForChild("HumanoidRootPart")
local Animator = Human:WaitForChild("Animator")

local idle = Animator:LoadAnimation(Animations.Idle)
local fw = Animator:LoadAnimation(Animations.WalkForward)
local fwr = Animator:LoadAnimation(Animations.WalkForwardRight)
1 Like

I don’t see why that might be the problem, I’ve always loaded the animation from the humanoid and there’s never been a problem. I change it to the animator and see what happens, THANK YOU!!!

1 Like

It doesn’t seem to have worked, it still breaks.

1 Like

After watching the video are you sure the animation is compatible with the rig, try loading it onto a test rig and also one of the other animations (which does work).

If the right-forward animation only works on that animation rig then that rig & the animation need to get updated to/for the right rig.
If the right-forward animation does not work then the animation needs to get updated for the right rig.

Also make sure the owner of the game is the owner of the animation.

2 Likes

I have a yes for both questions, I made the animations and I animated it on a rig(I also made it) that I copy-pasted as a starter character. I also made the script to show the animations.

1 Like

Yeah, but can you try loading both animations on the rig through the roblox animator, that is mainly what I am asking, because I assume the forwards right animation is messed up because it does not work properly.

I do not follow, I’m quite new to coding and animating. Sorry.
Do you mean to load them with the animator, I’ve already tried when you first told me to do that.

local RunService = game:GetService("RunService")

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Human = script.Parent:WaitForChild("Humanoid")
local Root = Char:WaitForChild("HumanoidRootPart")
local Animator = Human:WaitForChild("Animator")

local idle = Animator:LoadAnimation(Animations.Idle)
local fw = Animator:LoadAnimation(Animations.WalkForward)
local fwr = Animator:LoadAnimation(Animations.WalkForwardRight)

Okay so this has nothing to do with scripting. Open up the roblox Animation Editor on the rig you are using (you can duplicate this and put it somewhere inside workspace). Then import the forwardright animation onto that rig.
Check if the animation does load or does not, if it does not that is the issue.

Also make sure you are using the correct ids.

oh no, the first one is the one I imported, and the second is the one on the animating rig.

it’s probably triggering one of your earlier if statements and causing an overlap issue

I thought that at first. but I looked and couldn’t find anything.

1 Like

maybe has to do with you using -0.5, isn’t negative offset in object space backwards?

I used -0.5 because the direction vector is usually (0.707, 0, -0.707) when the player moves in the forward-right direction.

1 Like

only thing I can think of is your front right conditions are never met leading to it being treated as idle and constantly resetting

That doesn’t seem to be true. If I move to the forward-right first then it will play the animation.

Maybe try adjusting forward right to 0 weight before doing anything else for the other animations?

I imported the animation again and it worked. this isn’t the solution btw, this is about something earlier.

Aight, I found something online which is way better than mine.