i am making a custom character

the tittle only covers part

when i press w it goes forward

then i press shift to run it works

i then take my finger off of shift and the play slides for a sec then starts walking normally

  • sorry for long code *
game.Workspace.Camera.CameraType = Enum.CameraType.Attach
local UIS = game:GetService("UserInputService")

local animations_folder = script:WaitForChild("animations")
local player = script.Parent
local humanoid = player.Humanoid

local jump_forward = animations_folder:WaitForChild("jump_forward")
local run = animations_folder:WaitForChild("run")
local left = animations_folder:WaitForChild("left")
local forward = animations_folder:WaitForChild("forward")

local jump_forward_anim = humanoid.Animator:LoadAnimation(jump_forward)
local run_anim = humanoid.Animator:LoadAnimation(run)
local left_anim = humanoid.Animator:LoadAnimation(left)
local forward_anim = humanoid.Animator:LoadAnimation(forward)

local positions_folder = script.positions
local head_pos_value = positions_folder.head.Value

function input_started()
	if UIS:IsKeyDown(Enum.KeyCode.Space) and UIS:IsKeyDown(Enum.KeyCode.W) then
		jump_forward_anim:Play()
	end
	if UIS:IsKeyDown(Enum.KeyCode.A) then
		left_anim:Play()
	end
	if UIS:IsKeyDown(Enum.KeyCode.W) then
		forward_anim:Play()
		humanoid.WalkSpeed = 10
		run_anim:Stop()
	end
	if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then
		if UIS:IsKeyDown(Enum.KeyCode.W) then
			run_anim:Play()
			humanoid.WalkSpeed = 20
		end
	end
	if UIS:IsKeyDown(Enum.KeyCode.S) then
		forward_anim:Play()
	end
	if UIS:IsKeyDown(Enum.KeyCode.D) then
		
	end
end

function input_stopped()
	left_anim:Stop()
	forward_anim:Stop()
	run_anim:Stop()
end

while true do
	UIS.InputBegan:Connect(input_started)
	UIS.InputEnded:Connect(input_stopped)
	wait(0.1)
end

1 comment

0

hey, did you check my answer for your previous question?