How do I make gun bullets like in prison life?

I’m trying to make a third person gun, it works, I just need to implement the bullet effects, I want the one in prison life where there’s a yellow line stretching into where the mouse is. Any tutorials?

1 Like

This might be what you’re looking for.
The possible answer.

Do you use raycast while shooting?

Well actually there are 2 ways to do it.

You can use a part, position it at the midpoint between your cursor and where the mouse hit and stretch it then make it face one of the endpoints(the gun or the hitpoint) Make sue the gun is cancollide off and can cast shadow and can query off too.

Then debris the part after a bit

Second method is to use beams. They are much simpler to create and you can add extra effects but they require more instances to work.

Simply create an attachment on your gun and create an attachment at the targtpoint(you can place the attachment in terrain for convenience) add a beam then debris it after a second along with the target point.

Here is the general overview of what it looks like

local start = Vector3.new(0,10,0)
local end = Vector3.new(10,0,0)
-- Solution 1
local Part = Instance.new("Part",workspace)
Part.Position = (start + end)/2 -- Midpoint
Part.CFrame = CFrame.lookAt(Part.Position,end)
Part.Size = Vector3.new(0.1,0.1,(start - end).Magnitude)-- Length of bullet
-- Solution 2
local Att0 = Instance.new("Attachment",workspace.Terrain)
local Att1 = Instance.new("Attachment",workspace.Terrain)
Att0.Position = start
Att1.Position = end
local Bullet = Instance.new("Beam", workspace)
Bullet.Attachment0 = Att0
Bullet.Attachment1 = Att1

Of course this code isn’t optimized.(I forgot end is a keyword rip

Yes, I do… why’d do you ask?.