How to Weld Each Part of it while keeping the position?

I want to weld it to keep make it look smooth and so this what happens

local module = {}

module.createLighting = function(StartInstance, StartPos, endPos, segments)
	local points = {}
	local Model ="Model")
	Model.Name = "Lightning"
	Model.Parent = game.Workspace
	for i = 0, segments do
		local offset =,1),math.random(-1,1),math.random(-1,1))
		local position = StartPos + (endPos - StartPos).Unit * i * (endPos - StartPos).Magnitude / segments 
		if i == 0 or i == segments then
			offset =,0,0)
		points[#points + 1] = position + offset

	for i = 1, #points do
		if points[i + 1] ~= nil then
			local prevLightling 
			local Lightling = script.Part:Clone()
			Lightling.Size =,0.1,(points[i] - points[i + 1]).Magnitude)
			Lightling.Name =  "Part"..i..""
			Lightling.CFrame =[i] + points[i + 1]) / 2, points[i + 1])
			Lightling.Parent = Model
	return Model

return module

I run the module in a local script just for no dely

weld the lightning parts to a “base” part, like the humanoidrootpart, do some simple cframe maths to create it on the correct position

I don’t really know what you are going for but this seems really nice since it’s some sort of lightning

What do you mean by simple CFrame math

creating a simple formula for the lightning to look like lightning =w=
but FROM the cframe of the “base”

1 Like

Is it possible for a example i’m sorry if i’m asking too much :C

simple example -w-

1 Like