So i have a script here that work in a certain way but for some reason in one direction the animations work fine but in other direction dont work
The bug:
As you can see for some reason while moving foward right and back left the animations supress each other but this dont happend in the oposite directions
The Script (some partis i will add later but for now i need to fix the base movement)
local RunService = game:GetService('RunService')
local UserInputService = game:GetService("UserInputService")
local ReplicageStorage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart')
local Humanoid = Character:WaitForChild('Humanoid')
local Radius = 20
local Distances = {}
local Running = false
local Camera = workspace.CurrentCamera
local AnimationsFolder = script:WaitForChild('Animations')
local AnimationsTable = {
['Idle'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.Idle ),
['WalkForward'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.WalkForward ),
['WalkRight'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.WalkRight ),
['WalkLeft'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.WalkLeft ),
['Climp'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.Climb ),
['Jump'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.Jump ),
['Fall'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.Fall ),
['Run'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.Run ),
['Lended'] = Humanoid.Animator:LoadAnimation( AnimationsFolder.Lended )
}
for _, Animation in AnimationsTable do
Animation:Play( 0, 0.01, 0 )
end
function SetUp()
--Camera.CameraSubject = Character:WaitForChild("Head")
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
UserInputService.MouseIconEnabled = false
end
Player.CharacterAdded:Connect(function()
SetUp()
end)
SetUp()
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 Right = math.abs( math.clamp( DirectionOfMovement.X / Humanoid.WalkSpeed, 0.001, 1 ) )
local Left = math.abs( math.clamp( DirectionOfMovement.X / Humanoid.WalkSpeed, -1, -0.001 ) )
local SpeedUnit = (DirectionOfMovement.Magnitude / Humanoid.WalkSpeed)
local State = Humanoid:GetState()
if DirectionOfMovement.Magnitude > 0.1 then
if AnimationsTable.WalkForward.IsPlaying == false then
AnimationsTable.WalkForward:Play( 0,0.01,0 )
AnimationsTable.WalkRight:Play( 0,0.01,0 )
AnimationsTable.WalkLeft:Play( 0,0.01,0 )
end
end
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 )
AnimationsTable.Idle:AdjustWeight(0.001)
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 )
AnimationsTable.Idle:AdjustWeight(0.001)
end
if DirectionOfMovement.Magnitude < 0.1 then
AnimationsTable.Idle:AdjustWeight(1)
end
if State == Enum.HumanoidStateType.Jumping then
AnimationsTable.Jump:AdjustWeight(1)
AnimationsTable.WalkForward:AdjustWeight( 0.001 )
AnimationsTable.WalkRight:AdjustWeight( 0.001 )
AnimationsTable.WalkLeft:AdjustWeight( 0.001 )
AnimationsTable.Idle:AdjustWeight(0.001)
end
if State == Enum.HumanoidStateType.Landed then
AnimationsTable.Jump:AdjustWeight(0.001)
AnimationsTable.Idle:AdjustWeight(1)
end
end)
if someone have any idead how i can fix it or how i can make my script better i would like to hear