Why does LinearVelocity do this?

Hello, so I am making anime like moves where the player jumps up first but while using LinearVelocity I get this bug where the players also goes it a little to the front.


this is the code for it

if move == "Slam"  then
		print("fire")
		local char = player.Character
		local humanoid = char:WaitForChild("Humanoid")
		local root = char:WaitForChild("HumanoidRootPart")
		
		Helper.CreateLinearVelocity(root, Enum.VelocityConstraintMode.Vector, root.Position + Vector3.new(0,100,0), math.huge , root, 0.1)
		
		
	end

CreateLinearVelocity is a function that just creates one and deletes it after the last parameter

I dont think this has anything to do with the vector but just the how its calculated. Thanks for reading and have a nice day.

2 Likes

Also ignore the sounds of the video

2 Likes

Can you show the create linear velocity function’s code?

function Helper.CreateLinearVelocity(attachementParent, Mode, VectorVelocity, Force, parent, lifetime)
	if not attachementParent:FindFirstChildWhichIsA("Attachment") then
		local Attachment = Instance.new("Attachment")
		Attachment.Parent = attachementParent 
	end
	
	
	local LinearVelocity = Instance.new("LinearVelocity")
	LinearVelocity.VelocityConstraintMode = Mode
	LinearVelocity.Attachment0 = attachementParent:FindFirstChildWhichIsA("Attachment")
	LinearVelocity.MaxForce = Force
	LinearVelocity.VectorVelocity = VectorVelocity
	LinearVelocity.Parent = parent or attachementParent

	if lifetime and lifetime > 0 then
		task.delay(lifetime, function()
			if LinearVelocity.Parent then
				LinearVelocity:Destroy()
			end
		end)
	end
end```

Get rid of the root.Position so it’s just the vector.new.

Instead of root.Position + vector it’s just vector.

1 Like

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