#"Hopping" movement when mixing animations with script

1 messages · Page 1 of 1 (latest)

open grove
#

how do you think I can solve this issue where my 2 of my diagonal strafe animations result in hopping

I used this tutorial:
https://www.youtube.com/watch?v=aP_VzBxrPOA

https://medal.tv/nl/games/roblox-studio/clips/kifppNp6kcgVd90ot?invite=cr-MSxWRGwsMTc1MDY1MDE1

if walking forward would be north, then the "north-west" and "south-east" movements result in the hopping motion
YouTube

Discord server: https://discord.gg/nQkKWymxFP
support me: https://ko-fi.com/devdumb

feel free to ask questions in the discord
Didn't feel like making captions, Sorry about that.
Anyways, this is my first tutorial, so I hope you enjoy watching the video!
I also forgot to add an idle animation so if you want to add that you can use the 2nd or 3rd...

▶ Play video

Bekijk Roblox Studio en miljoenen andere Roblox Studio video's op Medal, het grootste Game Clip Platform.

▶ Play video
gaunt pilotBOT
#

studio** You are now Level 8! **studio

open grove
open grove
#

idk how to embed it

#

local Player = game.Players.LocalPlayer
local Character = Player.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")

local AnimationsFolder = script:WaitForChild("Animations")

local AnimationsTable = {
    
    ["WalkForward"] = Humanoid:LoadAnimation(AnimationsFolder.WalkForward),
    ["WalkLeft"] = Humanoid:LoadAnimation(AnimationsFolder.WalkLeft),
    ["WalkRight"] = Humanoid:LoadAnimation(AnimationsFolder.WalkRight),
    
}

for _, Animation in AnimationsTable do
    Animation:Play(0,0.01,0)
end

Runservice.RenderStepped:Connect(function()
    local DirectionOfMovement = HumanoidRootPart.CFrame:VectorToObjectSpace(HumanoidRootPart.AssemblyLinearVelocity)
    local Forward = math.abs(math.clamp(DirectionOfMovement.Z / Humanoid.WalkSpeed, -1,-0.001))
    local Backwards = math.abs(math.clamp(DirectionOfMovement.Z / Humanoid.WalkSpeed, 0.001,1))
    local Left = math.abs(math.clamp(DirectionOfMovement.X / Humanoid.WalkSpeed, 0.001,1))
    local Right = math.abs(math.clamp(DirectionOfMovement.X / Humanoid.WalkSpeed, -1,-0.001))
    
    local SpeedUnit = (DirectionOfMovement.Magnitude/Humanoid.WalkSpeed)
    
    if DirectionOfMovement.Z/Humanoid.WalkSpeed < 0.1 then
        
        AnimationsTable.WalkForward:AdjustWeight(Forward)
        AnimationsTable.WalkRight:AdjustWeight(Right)
        AnimationsTable.WalkLeft:AdjustWeight(Left)
        
        AnimationsTable.WalkForward:AdjustSpeed(SpeedUnit)
        AnimationsTable.WalkRight:AdjustSpeed(SpeedUnit)
        AnimationsTable.WalkLeft:AdjustSpeed(SpeedUnit)
        
    else
        
        AnimationsTable.WalkForward:AdjustWeight(Backwards)
        AnimationsTable.WalkRight:AdjustWeight(Left)
        AnimationsTable.WalkLeft:AdjustWeight(Right)

        AnimationsTable.WalkForward:AdjustSpeed((SpeedUnit) * -1)
        AnimationsTable.WalkRight:AdjustSpeed((SpeedUnit) * -1)
        AnimationsTable.WalkLeft:AdjustSpeed((SpeedUnit) * -1)
    end
end)```