What's in the question. I have a gun script that creates a part and makes it a projectile. But it makes the part go sideways.. So I want to make the part lookVector the same as the "ShootPart" lookVector. Any idea how to do that?
local bullet = Instance.new("Part",workspace) bullet.Name = "Bullet" bullet.BrickColor = BrickColor.new("New Yeller") bullet.Size = Vector3.new(1.5,0.5,0.5) bullet.Transparency = 0.5 bullet.Anchored = false bullet.FormFactor = "Custom" bullet.Material = "Neon" bullet.CanCollide = false bullet.CFrame = script.Parent.ShootPart.CFrame bullet.Orientation = Vector3.new(0,0,0) local BV = Instance.new("BodyVelocity",bullet) BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BV.Velocity = script.Parent.ShootPart.CFrame.lookVector*300
This is not a request of a script but a request of help.
Thanks!
So when you say go sideways, I'm not sure if you mean that the bullet goes sideways from the way the shoot part is pointed. But looking at your script I'm assuming that the bullet part is rotated so that it looks like it is sideways but is still moving where the gun points. I guess my fix would be to either change the bullet size so that its front face is the face that would be the ideal front of the bullet for you. You could also at line 9 doing this. It is either math.rad(90) or math.rad(-90)
bullet.CFrame = script.Parent.ShootPart.CFrame * CFrame.Angles(0,math.rad(90),0) -- or -90
As I'm righting this I realize that the shoot parts front face could be pointing sideways so that could also cause the bullet to go sideways For that in properties look for front face select that so you can see it. Then rotate the shootpart and reshape it so that its front face points the way you want.