How to make a custom character basic movement?

So recently I’ve been trying to make a custom character(Hamster) and don’t know how to implement basic movement since I never done this before. And I looked up on YouTube and Devforum but didn’t really find anything helpful.


Some photos to understand the basic layering of the character:

image


In terms of basic movement, there’s a couple ways to go about doing this. One method you could use is utilizing the Humanoid:Move() function, which works by moving the character in a specified Vector3 direction. To start you’d want to map the movement keys both for input and the Vector3 direction that said key will move you to. It should look something like this:

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);
}

You could then use the UserInputService to set the inputs to their activated values when pressed and then run a loop something along the lines of this:

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, true)
end)

Hope this helps. Reply if you have any questions

1 Like

Hey! It didn’t really worked, but thanks for help I understand a little bit more of scripting custom characters.