|
| 14 Jun 2016 11:23 PM |
local function newRay(point1,point2,ignore) local ray = Ray.new(point1, (point1 - point2).unit * (point1-point2).magnitude) local part, position = workspace:FindPartOnRay(ray, ignore, false, true) local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("Bright red"); beam.FormFactor = "Custom"; beam.Material = "Neon"; beam.Transparency = 0.15; beam.Anchored = true; beam.Locked = false; beam.CanCollide = false; local distance = (point1 - position).magnitude beam.Size = Vector3.new(1, 1, distance) beam.CFrame = CFrame.new(point1, position) * CFrame.new(0, 0, distance / 2) end
local function RandomLightning(point1, point2) local splits = math.random(5,10) local param1 = -3; local param2 = 3; local randomPoints = {}; for i = 1, splits, 1 do local POINT = point1:Lerp(point2, i/splits); local x = math.random(param1,param2) local y = math.random(param1,param2) local z = math.random(param1,param2) POINT = POINT + Vector3.new(x,y,z) table.insert(randomPoints, POINT); end for i = 0, splits-1, 1 do local a = randomPoints[i]; if i == 0 then a = point1; end newRay(a, randomPoints[i+1]) end end wait(3) RandomLightning(game.Workspace.Part1.Position, game.Workspace.Part2.Position)
This is my script to make lightning. It finds two points, makes more points with a little distortion between them, then connects all the points.
But when it generates sometimes one or two of the beams dont get generated, and theres no errors.
Thanks guys. Nothing wrong with beam script, look into RandomLightning for bugs |
|
|
| Report Abuse |
|
| |
| |
|
| 14 Jun 2016 11:54 PM |
| Like the stravants lightning gear cmon guys |
|
|
| Report Abuse |
|
Grevok
|
  |
| Joined: 07 Jul 2013 |
| Total Posts: 1652 |
|
| |
| |
| |
Despawned
|
  |
| Joined: 06 Apr 2013 |
| Total Posts: 12569 |
|
|
| 15 Jun 2016 04:11 PM |
print("Hello World!")
totally fixes it man
|
|
|
| Report Abuse |
|
|
| 15 Jun 2016 04:16 PM |
| You guys are messing with me |
|
|
| Report Abuse |
|