What do I need to know to make a directional movement system?

I want to make a directional movement script and already have the animations finished. I just want to know where I should look to begin learning how to make one.

What is it? Are you asking how do you move stuff? Or are you asking about the player control system for moving around? (Which is enabled by default, so you don’t need to create it).

What kinds of animations are they? For models? Are you asking how to move models?

Given that all movement systems are directional, what’s different about the one you want to create?

Pretty much, I have animations of the character moving left, right, forward, and back while shift locked or in first person. I just want to know what I should learn so I can implement those animations.

Ah, in that case: Using Animations | Documentation - Roblox Creator Hub .

1 Like

You’d mainly need to know:

Humanoid.MoveDirection

that’s all the main thing I can thihnk of that youl’ll worudl need.

1 Like

As @PreciseGaps said, the main thing is the MoveDirection, but theres a thing that you need to do for it.

You need to get the HumanoidRootPart and do :Dot() to get a scaled value, heres an example:

while true do
	task.wait(0.1)
	local plr = game.Players.LocalPlayer
	local char = plr.Character or plr.CharacterAdded:Wait()
	local hum:Humanoid = char:WaitForChild("Humanoid")
	local rootpart = char:WaitForChild("HumanoidRootPart")

	local chosenface = "Front"

	local scaledlook = rootpart.CFrame.LookVector:Dot(hum.MoveDirection)
	local scaledleft = (rootpart.CFrame.RightVector * -1):Dot(hum.MoveDirection)
	local scaledright = rootpart.CFrame.RightVector:Dot(hum.MoveDirection)
	local scaledback = (rootpart.CFrame.LookVector * -1):Dot(hum.MoveDirection)

	if scaledlook > 0.5 then
		chosenface = "Front"	
	elseif scaledback > 0.5 then
		chosenface = "Back"
	elseif scaledright > 0.325 then
		chosenface = "Right"
	elseif scaledleft > 0.325 then
		chosenface = "Left"
	end
	
	print(chosenface)
end

This will probably resolve your problem, basic if the player is with the shiftlock activated, if the player is looking to the front but going to the right, the chosenface will be “Right”, and will be perfect with your animation

Hope it helps!

1 Like