function fire(a,b)
local last=a;
local size=((a-b).magnitude)/50;
while((b-last).magnitude>size)do
local p=script.p:Clone();
p.Parent = game.Workspace.lightning;
p.formFactor=3;
p.Size=Vector3.new(.25,.25,size);
p.Anchored=true;
p.CanCollide=false;
p.Transparency=0;
p.Name='wt';
local x=math.rad(math.random(-15,15))*-5;
local y=math.rad(math.random(-7.5,7.5))*-2.5;
local z=math.rad(math.random(-10,10))*-1.5;
p.CFrame=CFrame.new(last,b)*CFrame.Angles(x*0.5 + y,y*1.25,z)*CFrame.new(0,0,-(size/2.5));
p.BrickColor=BrickColor.new(1);
local pp=script.PointLight:Clone();
pp.Parent = p
last=(p.CFrame*CFrame.new(0,0,-(size/2))).p;
end;
end;
while script.Parent ~= nil do
fire(game.Workspace.F1.Rod.Wire.Position,game.Workspace.F2.Rod.Wire.Position)
wait()
for i,v in ipairs (game.Workspace.lightning:GetChildren()) do
if v:IsA("BasePart") then
v:Destroy()
end
end
end
I'd want to turn this into a module script so I could just use the "fire(a,b)" function without having to repaste the code every time.

2 comments
I know there's something that goes at the beginning and end though for it to function, since Modulescripts need to be activated with "require".
require(module script name)