Walking Animation Problem

Hello, so I made a post about making a custom character moving and I got it done, but I don’t know how to make it so when the key W is being down and the player is moving the animation would play the running/walking animation is not it will play the standing animation, here is some kind of script that I tried but didn’t end up working:

-- // CONSTANTS
Normal_Walkspeed = 16

-- // VARIABLES
local Character_Model = script.Parent.Parent.StarterCharacter
local UserInputService = game:GetService("UserInputService")
local Camera = game.Workspace.CurrentCamera
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:FindFirstChild("Humanoid")
local Walk = script.Animations.DefaultRun
local Stand = script.Animations.DefaultStand

-- // MAIN CODE



-- MOVEMENT LOGIC [WIP]
local moveInput = {
	[Enum.KeyCode.W] = 0;
	[Enum.KeyCode.S] = 0;
	[Enum.KeyCode.A] = 0;
	[Enum.KeyCode.D] = 0;
}

local moveVectors = {
	[Enum.KeyCode.W] = Vector3.new(0,0,-1);
	[Enum.KeyCode.S] = Vector3.new(0,0,1);
	[Enum.KeyCode.A] = Vector3.new(-1,0,0);
	[Enum.KeyCode.D] = Vector3.new(1,0,0);
}

game:GetService('RunService').RenderStepped:connect(function()
local vector = Vector3.new();

for i,v in pairs(moveInput) do
	vector = vector + moveVectors[i] * v
end
	Humanoid:Move(vector, Walk:Play(), true)
end)
1 Like