Make player jump stuck in the direction they were jumping (with controls being stuck too)

Hello! i’m having trouble with making the player jump in a direction that they were facing without being able to change direction mid-jump. just like it worked in 2007


See how i only change direction when i land? i want to achieve that but i have no idea where to even begin with this. Help is appreciated!

2 Likes

Here is my script.

I utilized HumanoidStateChange to identify the player’s jumping, landing, and free falling actions.

To prevent the Humanoid from changing direction, you can disable Auto Rotate.

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")

Humanoid.StateChanged:Connect(function(oldState, newState)
	if Enum.HumanoidStateType.Landed == newState then
		Humanoid.AutoRotate = true
	elseif Enum.HumanoidStateType.Freefall == newState then
		Humanoid.AutoRotate = false
	elseif Enum.HumanoidStateType.Jumping == newState then
		Humanoid.AutoRotate = false
	end
end)
2 Likes

the script worked! there is just a thing that i want to also do with this but i don’t know how to. i want the player to not be able to go left or right when jumping, so as shown in the video the player jumps in one direction even though i was pressing W and D keys. Hope i somehow explained it if not then please let me know! (and sorry if i’m asking for too much.)

1 Like

Hey yo! this seems like a challenge to figure out the direction, but maybe getting the directional velocity of HumanoidRootPart seems like solution!

Were you able to figure out how to make a stuck directional jump? I’m trying to get the same result even if character has shiftlock while jumping!

i have found how to do this myself, what you basically have to do is get the velocity of the humanoid in a variable when they jump and set the current velocity to the variable one and repeat that until the character touches the ground

2 Likes

Should you save the velocity variable as soon as jump is triggered? Or after task.wait(.25). I haven’t tested but it seems like the velocity would be little to none if you save the variable as soon as jump is triggered. Maybe not because of potential energy. But I don’t know if Roblox follows potential energy with velocity.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.