Bhop based on lookVector

  1. I’d like to make Bunny Hop with creating a new VectorForce based on Workspace.Camera.CFrame.lookVector so that when the player jumped it was created a vector force pushing it in the direction of the camera for 0.5 seconds and then destroying the vector Force

  2. VectorForce Creating with wrong direction

  3. I tried to change the values given to the vectorForce() function but it didn’t work

  4. Here`s the code:

-- Functions
function vectorForce(Vector)
	local VectorForce = Instance.new('VectorForce')
	VectorForce.Parent = char.HumanoidRootPart
	VectorForce.Attachment0 = char.HumanoidRootPart.RootAttachment
	VectorForce.Force = Vector
	print('forceApplied')
end

function clearForce(location)
	for i,v in pairs(location:GetDescendants()) do
		if v:IsA('VectorForce') == true then
			v:Destroy()
		end
	end
end
-- Bhop Control
humanoid.Running:Connect(function(speed)
	print(speed)
	if speed > 11 then
		if not RunAnim.IsPlaying then
			RunAnim:Play(1,1,2)
			CameraUp:Play()
			SpeedUp:Play()
			forceApplied = false
		end
		UIS.InputBegan:Connect(function(input)
			if speed > 11 and input.KeyCode == Enum.KeyCode.Space and humanoid.MoveDirection.Magnitude > 0 and BHopCooldown == false then
				BHopCooldown = true
				vectorForce(Camera.CFrame.lookVector * 1000)
				print(Camera.CFrame.lookVector * 1000)
				wait(0.5)
				--clearForce(char.HumanoidRootPart)
				BHopCooldown = false
			end
		end)
1 Like

try humanoid.cframe.lookvector if that works

CFrame is not a valid member of Humanoid “Workspace.FozikWasHere.Humanoid”

He is referring to HumanoidRootPart.

my bad im an idiot
i meant humanoidrootpart

I would suggest to use :ApplyImpulse() rather than using a vectorforce as well. Maybe that would work?

2 Likes

same situation with HumanoidRootPart

Have you tried using my actual solution to the issue? That post is just me correcting @MikeartsRBLX. LOL! I was not expecting my answer to solve this issue.

If you defined the variable “Camera” before you started bhopping, I’m pretty sure it’d get the lookvector from the time you defined it. Try re-defining / updating the camera variable every time you want to bhop.

-- Functions
function vectorForce(Vector)
	local VectorForce = Instance.new('VectorForce')
	VectorForce.Parent = char.HumanoidRootPart
	VectorForce.Attachment0 = char.HumanoidRootPart.RootAttachment
	VectorForce.Force = Vector
	print('forceApplied')
end

function clearForce(location)
	for i,v in pairs(location:GetDescendants()) do
		if v:IsA('VectorForce') == true then
			v:Destroy()
		end
	end
end
-- Bhop Control
humanoid.Running:Connect(function(speed)
	print(speed)
	if speed > 11 then
		if not RunAnim.IsPlaying then
			RunAnim:Play(1,1,2)
			CameraUp:Play()
			SpeedUp:Play()
			forceApplied = false
		end
		UIS.InputBegan:Connect(function(input)
			if speed > 11 and input.KeyCode == Enum.KeyCode.Space and humanoid.MoveDirection.Magnitude > 0 and BHopCooldown == false then
				BHopCooldown = true
                                Camera = workspace.CurrentCamera
				vectorForce(Camera.CFrame.lookVector * 1000)
				print(Camera.CFrame.lookVector * 1000)
				wait(0.5)
				--clearForce(char.HumanoidRootPart)
				BHopCooldown = false
			end
		end)

even with this thats still do wrong vector3 force

If the impulse worked, then you can use that with the camera lookvector.

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