Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Laser Gun Beam Not Shooting In Correct Direction?

Asked by 2 years ago

This is a repost because my last post got 80 views but no one is commenting or answering so I want to get people to notice because it is a real problem I can't fix.

Hello developers. I am currently making a laser gun with a long laser beam that shoots out when you click. However, the laser beam doesn't go straight, but it goes to the center of the object I am shooting at. I was wondering how I could make the laser beam go straight no matter what is in the way and so it doesn't just go to the center of the object.

Here is the local script located in the laser gun:

01function CreateBullet(Origin, Direction)
02    local MidPoint = Origin.Position + Direction/2
03 
04    local beam = Instance.new("Part", nil)
05    beam.Name = "LaserBullet"
06    beam.Anchored = true
07    beam.CanCollide = false
08    beam.Massless = true
09    beam.Locked = true
10    beam.Parent = workspace
11    beam.BrickColor = Player.TeamColor
12    beam.Material = Enum.Material.Neon
13    beam.Transparency = 0
14    beam.Size = Vector3.new(0.05, 0.05, Direction.Magnitude)
15    beam.Orientation = Origin.Orientation
View all 70 lines...

Thanks for reading!

Answer this question