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)```
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)
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!!!
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.
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.
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.