How to make "Beam of light"?

Hello, I am working on a game and want to create a kind of beam of light stretching across 2 parts that looks similar to an instance light, like a point light or a surface light but I can’t find anything that helps me.

Here is an image of what I want to achieve:
image

I have tried using a script to make an invisible Part that stretches across that line and puts a SurfaceLight in it facing down, but I can’t seem to make the part stretch diagonally.

Help is appreciated!

1 Like

I don’t think this a script thing…
But you can use beams

The reason I put it in scripting support is because I need help on how to make a script to continuously stretch out a part between two positions.

And beams won’t work because I want them to look like SurfaceLights.

Could you show a better example? I don’t really get what you mean, a beam would stretch if the attachments follow the part

Yeah, sorry I am new to the devforum.

I want to kind of make an invisible part that acts like a beam that also has a SurfaceLight inside it that points down.

But I don’t think you can put a SurfaceLight inside a beam and it would work the same way as a part.

What is this being used for?
Is it supposed to be like a light beam from a light or kind of like a laser?

This will help me figure out what you need

Thank you for the reply!

Basically, I am using this module:
[Effect] v1.1 Lightning Beams: Seamless, smooth and procedurally animated with beam-like properties - Resources / Community Resources - DevForum | Roblox

To make lightning beams between 2 parts. But it doesn’t emit light. So, I am trying to make a light source along the lightning to do that.

Here’s how I did this:

Basically, I fit a part between the two points. Then, I divide the part into sections based off how large you want the lights to be. Then I make an attachment in the part with a point light per section.

Here’s my script:


local LightWidth = 10 -- How wide the light goes

local Folder = script.Parent
local Part = Folder.Part
local PointA = Folder.a.Position
local PointB = Folder.b.Position

local Distance = (PointA - PointB).Magnitude
local Size = Vector3.new(.1, .1, Distance)
local Cframe = CFrame.new(PointA, PointB) * CFrame.new(0, 0, -Distance/2)
local FrontOfPart = (Cframe * CFrame.new(0,0,-Distance/2)).p
local BackOfPart = (Cframe * CFrame.new(0,0,Distance/2)).p

Part.Size = Size
Part.CFrame = Cframe

local NumberOfLights = Distance/LightWidth

for i = 1,NumberOfLights do
	
	local Position = FrontOfPart:Lerp(BackOfPart,(i/NumberOfLights))
	
	local Attachment = Instance.new("Attachment")
	Attachment.Parent = Part
	Attachment.WorldPosition = Position
	
	local Light = Instance.new("PointLight")
	Light.Parent = Attachment
	Light.Range = LightWidth
	
	Light.Brightness = 10
	
end

How my workspace is set up:

image

(“part” is the part thats being stretched between the two points)

Thank you so much! I will try that.

If it works, I will mark it as a solution.

1 Like