The image shows what I’m trying to create
Here’s a bit of code to help you out.
Visual Beam:
local beamWidth = 0.5 -- Thickness of beam
local originPosition = --origin vector3
local targetPosition = --target vector3
local part = Instance.new("Part")
local direction = targetPosition-originPosition
part.CFrame = CFrame.new(originPosition + direction/2,targetPosition)
part.Size = Vector3.new(beamWidth,beamWidth,direction.Magnitude)
--Optional part settings:
part.Anchored = true
part.CanCollide = false
part.Material = Enum.Material.Neon
part.Parent = workspace
Edit: Make sure to parent the part to workspace
can you give me the script of the gun ? and please use format. thanks.
I’m sorry I don’t mean to be rude but I asked for the gun-beam not parts
You could add a trail to the gun’s bullet. ¯_(ツ)_/¯
True but, what about the attachment positions
Yeah he could code that, or just follow any random tutorial on youtube ¯_(ツ)_/¯
Tried finding but there was none .-.
You could use ray casting for that ¯_(ツ)/¯ i just discord this thing "¯_(ツ)/¯" and i love it
I can use raycast for the beam?
for the pistol, and just add a trail with a code handling attachements, its simple
Yes, but my gun doesn’t shoot like actual guns, it shoots instantly. I’m very sorry for wasting your time on this by the way
Oh its alright, well in that case, my dumbass brain cant help you, sorry .
Ah, It’s alright. I’ll just wait like a sore loser until someone helps me xD. Appreciate for the help tho!
use beam, the first attachment’s position will be the tool’s Handle position, and the second attachment position will be Ray’s Hit Position, where it is Position
Okay, will try out. Thanks!
Okay, Mark as solution if helped, Have a Nice Day
local beam = Instance.new("Beam", Lazer)
local att1 = Instance.new("Attachment", Lazer)
local att2 = Instance.new("Attachment", Lazer)
att1.Position = tool.Handle.Position
att2.Position = Position
beam.Attachment0 = att1
beam.Attachment1 = att2
Lazer is the part ***