Make bodyvelocity on part at wherever the bottom of R6 Leg is facing

I wanna make a Pika Kick but for some reason my BodyVelocity isn’t working as I expected it to.

I want the yellow part thing to get shot from the bottom of the leg at wherever it’s facing.


The arrow is where i want it to come out and then shoot.

Instead I get this result to which the part is facing wherever the front area of the Leg is.


The arrow on the middle indicates where the part is going (moving).
image

Here is the reference gif.
kizaru-ichi
As you can see the character “Kizaru” shoots a light beam from his foot, that’s what im trying to do.

My script:

local functions = {}

function functions.Start(plr, humrp)
	local lightray = script.Light
	local pos = humrp.CFrame
	
	local lightclone = lightray:Clone()
	lightclone.Parent = workspace
	lightclone.CFrame = pos
	local BodyVel = Instance.new("BodyVelocity")
	BodyVel.Parent = lightclone
	BodyVel.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	BodyVel.Velocity = humrp.Parent["Left Leg"].CFrame.LookVector
end

return	functions
1 Like

Have you tried humrp.Parent["Left Leg"].CFrame.UpVector * -1?

2 Likes

You could have just done

-humrp.Parent["Left Leg"].CFrame.UpVector
1 Like

Since we are working with velocities, you shouldn’t do it that way because there are some cases where you have to copy and paste the direction and change it from UpVector to LookVector, or RightVector. The easiest way to change the direction is if both the sign and number are next to each other to achieve better workflow.

For begginers I guess. But I prefer the very micro optimisation rather than understandability. Unless if I want to change speed

I did this but the problem is it’s not moving in the direction the leg is facing as soon as it gets cloned into workspace. It’s not moving that fast aswell.

In that case, change the 1 to your preferred speed. For example, change from -1 to -150 or a bigger number.

That did work, but how do I detect if the BodyVelocity hits the ground or hits someone or an NPC?

and also I have another problem :slightly_frowning_face: Clone is multiplying everytime the modulescript is required!

You should use raycasting for the first part, but that is off topic.

Either make a new post about it or dm to start a new topic.