I'm having problem with LinearVelocity

I’m trying to make a dunk, and the problem happens when I tried scripting player’s movement. The LinearVelocity just don’t seem to be acting what I thought it should be. I also spawned a little brick there, as a reference. Here’s the script.

local m = c.Model
	local HRP = c.HumanoidRootPart
	
	
	local v = Instance.new("LinearVelocity",HRP)
	v.Attachment0 = HRP.RootRigAttachment
	
	v.VelocityConstraintMode = Enum.VelocityConstraintMode.Line
	v.MaxForce = 18000
	v.LineDirection = HRP.CFrame.LookVector
	v.LineVelocity = 20
	wait(.3)
	v.Enabled = false
	
	v.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
	v.MaxForce = 900
	
	spawn(function()
		
		local p = Instance.new("Part",workspace)
		p.Color = Color3.fromRGB(255,0,0)
		p.Position = HRP.CFrame*CFrame.new(0,5,-50).Position
		p.CFrame = CFrame.new(p.Position,c.HumanoidRootPart.CFrame.LookVector)
		p.Anchored = true
		p.CanCollide = false
		
	end)
	
	v.VectorVelocity = HRP.CFrame*CFrame.new(0,5,-50).Position
	
	
	wait(.1)
	v.Enabled = true
	wait(.4)
	v.Enabled = false
1 Like

I am having my owns problems with LinearVelocity, but I don’t know if this will help your case. Instead of “v.VectorVelocity = HRP.CFrame * CFrame.new(0,5,-50).Position” my idea would be to put “v.VectorVelocity = CFrame.new(HRP.Position,(HRP.CFrame * CFrame.new(0,5,-50)).Position).lookVector*50”

Probably won’t but worth a try.

1 Like

when you Instance LinearVelocity it is relative to world space means CFrame.LookVecrtor will accelerate to the world and to fix that

v.RelativeTo = Enum.ActuatorRelativeTo.Attachment0

add this line below

tried this, i’m pretty sure world is the right relative, atleast that’s what roblox saying

POOOG you’re the greatest, but I’m still just curious why this is happening, so Imma keep the thread open, to see if someone gives a new answer

1 Like

if you are using LookVector then everything you will need is increase magnitude and make sure that LinearVelocity relative to attachemnt0
in this case

v.VectorVelocity = CFrame.new(HRP.Position,(HRP.CFrame * CFrame.new(0,5,-50)).Position).lookVector*50

you are doing the same thing but relative to world