Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Projectile use lookVector for Velocity?

I'm trying to make a projectile use the aimed direction to shoot a projectile. I tried doing this

potato.CFrame = CFrame.new(potato.CFrame.Position,plr.Character:FindFirstChild("HumanoidRootPart").CFrame.lookVector)
		potato.Velocity = Vector3.new(-exitforce,0,0)

but it does not work. How would I do this? The idea of the script excerpt was to make the look Vector point forward and use the X-axis to shoot it forward.

Basically: How do I shoot a projectile at a certain speed at a certain direction (direction is dictated by the CFrame.Angles() of the character and speed is by a variable)

2 comments

0

I recommend using bodymovers due to lag issues, lookvector may work, but it's not the best option here

0

Also you could use remoteevents to reduce the projectile lag

1 answer

You can use BodyGyro to change direction, and BodyVelocity separately to do this. Funny thing is I just started with a plane that measures forward velocity relative to the part's cframe. Anyway, I set my bodygyro cframe by: BodyGyroName.CFrame = CFrame.new(Vector3.New(), --[[ LookAt position]] and you could do BodyVelocityName.Velocity= Vector3.New(Part.CFrame.LookVector.X*-exitforce,Part.CFrame.LookVector.Y*-exitforce,Part.CFrame.LookVector.Z*-exitforce) for the speed.

This discussion is preserved as it was. New answers, comments, and votes are closed.