# lightning

Nov 24th, 2021 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. part = Instance.new("Part",script)
2. part.Anchored = true
3. part2 = Instance.new("Part",script)
4. part2.Anchored = true
5. part.CFrame = CFrame.new(5,7.5,5)
6. part2.CFrame = CFrame.new(5,7.5,30)
7. part.Color = Color3.fromRGB(255,255,255)
8. part2.Color = Color3.fromRGB()
9. on = true
10. function the()
11. coroutine.wrap(function()
12. local intersection = part.Position + (part2.Position - part.Position)
13. local distance = (part.Position - intersection).Magnitude
14. local point1 = Instance.new("Part",script)
15. point1.Anchored = true
16. point1.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.25)
17. local point2 = Instance.new("Part",script)
18. point2.Anchored = true
19. point2.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.5)
20. local point3 = Instance.new("Part",script)
21. point3.Anchored = true
22. point3.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.75)
23. local intersection2 = part2.Position + (point3.Position - part2.Position)
24. local distance2 = (part2.Position - intersection2).Magnitude
25. local arc = Instance.new("Part",script)
26. arc.Anchored = true
27. arc.Size = Vector3.new(0.5,0.5,distance2)
28. arc.CFrame = CFrame.new(part2.Position, intersection2) * CFrame.new(0,0,-distance2/2)
29. local intersection3 = point3.Position + (point2.Position - point3.Position)
30. local distance3 = (point3.Position - intersection3).Magnitude
31. local arc2 = Instance.new("Part",script)
32. arc2.Anchored = true
33. arc2.Size = Vector3.new(0.5,0.5,distance3)
34. arc2.CFrame = CFrame.new(point3.Position, intersection3) * CFrame.new(0,0,-distance3/2)
35. local intersection4 = point2.Position + (point1.Position - point2.Position)
36. local distance4 = (point2.Position - intersection4).Magnitude
37. local arc3 = Instance.new("Part",script)
38. arc3.Anchored = true
39. arc3.Size = Vector3.new(0.5,0.5,distance4)
40. arc3.CFrame = CFrame.new(point2.Position, intersection4) * CFrame.new(0,0,-distance4/2)
41. local intersection5 = point1.Position + (part.Position - point1.Position)
42. local distance5 = (point1.Position - intersection5).Magnitude
43. local arc4 = Instance.new("Part",script)
44. arc4.Anchored = true
45. arc4.Size = Vector3.new(0.5,0.5,distance5)
46. arc4.CFrame = CFrame.new(point1.Position, intersection5) * CFrame.new(0,0,-distance5/2)
47. local arc5 = Instance.new("Part",script)
48. local arc6 = Instance.new("Part",script)
49. local arc7 = Instance.new("Part",script)
50. local arc8 = Instance.new("Part",script)
51. arc5.Material = "Glass"
52. arc6.Material = "Glass"
53. arc7.Material = "Glass"
54. arc8.Material = "Glass"
55. arc5.Size = Vector3.new(0.75,0.75,distance2 + 0.25)
56. arc6.Size = Vector3.new(0.75,0.75,distance3 + 0.25)
57. arc7.Size = Vector3.new(0.75,0.75,distance4 + 0.25)
58. arc8.Size = Vector3.new(0.75,0.75,distance5 + 0.25)
59. GlassWeld = Instance.new("Weld", arc)
60. GlassWeld.Part0 = arc
61. GlassWeld.Part1 = arc5
62. GlassWeld2 = Instance.new("Weld", arc2)
63. GlassWeld2.Part0 = arc2
64. GlassWeld2.Part1 = arc6
65. GlassWeld3 = Instance.new("Weld", arc3)
66. GlassWeld3.Part0 = arc3
67. GlassWeld3.Part1 = arc7
68. GlassWeld4 = Instance.new("Weld", arc4)
69. GlassWeld4.Part0 = arc4
70. GlassWeld4.Part1 = arc8
71. arc.Material = "Neon"
72. arc2.Material = "Neon"
73. arc3.Material = "Neon"
74. arc4.Material = "Neon"
75. arc.Color = Color3.fromRGB(91, 130, 2555)
76. arc2.Color = Color3.fromRGB(91, 130, 2555)
77. arc3.Color = Color3.fromRGB(91, 130, 2555)
78. arc4.Color = Color3.fromRGB(91, 130, 2555)
79. arc5.Color = Color3.fromRGB(91, 130, 255)
80. arc6.Color = Color3.fromRGB(91, 130, 255)
81. arc7.Color = Color3.fromRGB(91, 130, 255)
82. arc8.Color = Color3.fromRGB(91, 130, 255)
83. arc5.Transparency = .5
84. arc6.Transparency = .5
85. arc7.Transparency = .5
86. arc8.Transparency = .5
87. point1.CanCollide = false
88. point1.Transparency = 0
89. point2.CanCollide = false
90. point2.Transparency = 0
91. point3.CanCollide = false
92. point3.Transparency = 0
93. arc.CanCollide = false
94. arc2.CanCollide = false
95. arc3.CanCollide = false
96. arc4.CanCollide = false
97. arc5.CanCollide = false
98. arc6.CanCollide = false
99. arc7.CanCollide = false
100. arc8.CanCollide = false
101. pcall(function()
102. while true do
103. wait(0.125)
104. if on then
105. arc5.Transparency = .5
106. arc6.Transparency = .5
107. arc7.Transparency = .5
108. arc8.Transparency = .5
109. arc.Transparency = 0
110. arc2.Transparency = 0
111. arc3.Transparency = 0
112. arc4.Transparency = 0
113. local intersection = part.Position + (part2.Position - part.Position)
114. local distance = (part.Position - intersection).Magnitude
115. point1.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.25)
116. point2.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.5)
117. point3.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.75)
118. local intersection2 = part2.Position + (point3.Position - part2.Position)
119. local distance2 = (part2.Position - intersection2).Magnitude
120. arc.CFrame = CFrame.new(part2.Position, intersection2) * CFrame.new(0,0,-distance2/2)
121. arc.Size = Vector3.new(0.5,0.5,distance2)
122. local intersection3 = point3.Position + (point2.Position - point3.Position)
123. local distance3 = (point3.Position - intersection3).Magnitude
124. arc2.CFrame = CFrame.new(point3.Position, intersection3) * CFrame.new(0,0,-distance3/2)
125. arc2.Size = Vector3.new(0.5,0.5,distance3)
126. local intersection4 = point2.Position + (point1.Position - point2.Position)
127. local distance4 = (point2.Position - intersection4).Magnitude
128. arc3.CFrame = CFrame.new(point2.Position, intersection4) * CFrame.new(0,0,-distance4/2)
129. arc3.Size = Vector3.new(0.5,0.5,distance4)
130. local intersection5 = point1.Position + (part.Position - point1.Position)
131. local distance5 = (point1.Position - intersection5).Magnitude
132. arc4.CFrame = CFrame.new(point1.Position, intersection5) * CFrame.new(0,0,-distance5/2)
133. arc4.Size = Vector3.new(0.5,0.5,distance5)
134. arc5.Size = Vector3.new(0.75,0.75,distance2 + 0.25)
135. arc6.Size = Vector3.new(0.75,0.75,distance3 + 0.25)
136. arc7.Size = Vector3.new(0.75,0.75,distance4 + 0.25)
137. arc8.Size = Vector3.new(0.75,0.75,distance5 + 0.25)
138. else
139. arc5.Transparency = 1
140. arc6.Transparency = 1
141. arc7.Transparency = 1
142. arc8.Transparency = 1
143. arc.Transparency = 1
144. arc2.Transparency = 1
145. arc3.Transparency = 1
146. arc4.Transparency = 1
147. end
148. end
149. end)
150. end)()
151. end
152. function the2()
153. coroutine.wrap(function()
154. local intersection = part.Position + (part2.Position - part.Position)
155. local distance = (part.Position - intersection).Magnitude
156. local point1 = Instance.new("Part",script)
157. point1.Anchored = true
158. point1.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.25)
159. local point2 = Instance.new("Part",script)
160. point2.Anchored = true
161. point2.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.5)
162. local point3 = Instance.new("Part",script)
163. point3.Anchored = true
164. point3.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.75)
165. local intersection2 = part2.Position + (point3.Position - part2.Position)
166. local distance2 = (part2.Position - intersection2).Magnitude
167. local arc = Instance.new("Part",script)
168. arc.Anchored = true
169. arc.Size = Vector3.new(0.5,0.5,distance2)
170. arc.CFrame = CFrame.new(part2.Position, intersection2) * CFrame.new(0,0,-distance2/2)
171. local intersection3 = point3.Position + (point2.Position - point3.Position)
172. local distance3 = (point3.Position - intersection3).Magnitude
173. local arc2 = Instance.new("Part",script)
174. arc2.Anchored = true
175. arc2.Size = Vector3.new(0.5,0.5,distance3)
176. arc2.CFrame = CFrame.new(point3.Position, intersection3) * CFrame.new(0,0,-distance3/2)
177. local intersection4 = point2.Position + (point1.Position - point2.Position)
178. local distance4 = (point2.Position - intersection4).Magnitude
179. local arc3 = Instance.new("Part",script)
180. arc3.Anchored = true
181. arc3.Size = Vector3.new(0.5,0.5,distance4)
182. arc3.CFrame = CFrame.new(point2.Position, intersection4) * CFrame.new(0,0,-distance4/2)
183. local intersection5 = point1.Position + (part.Position - point1.Position)
184. local distance5 = (point1.Position - intersection5).Magnitude
185. local arc4 = Instance.new("Part",script)
186. arc4.Anchored = true
187. arc4.Size = Vector3.new(0.5,0.5,distance5)
188. arc4.CFrame = CFrame.new(point1.Position, intersection5) * CFrame.new(0,0,-distance5/2)
189. local arc5 = Instance.new("Part",script)
190. local arc6 = Instance.new("Part",script)
191. local arc7 = Instance.new("Part",script)
192. local arc8 = Instance.new("Part",script)
193. arc5.Material = "Glass"
194. arc6.Material = "Glass"
195. arc7.Material = "Glass"
196. arc8.Material = "Glass"
197. arc5.Size = Vector3.new(0.75,0.75,distance2 + 0.25)
198. arc6.Size = Vector3.new(0.75,0.75,distance3 + 0.25)
199. arc7.Size = Vector3.new(0.75,0.75,distance4 + 0.25)
200. arc8.Size = Vector3.new(0.75,0.75,distance5 + 0.25)
201. GlassWeld = Instance.new("Weld", arc)
202. GlassWeld.Part0 = arc
203. GlassWeld.Part1 = arc5
204. GlassWeld2 = Instance.new("Weld", arc2)
205. GlassWeld2.Part0 = arc2
206. GlassWeld2.Part1 = arc6
207. GlassWeld3 = Instance.new("Weld", arc3)
208. GlassWeld3.Part0 = arc3
209. GlassWeld3.Part1 = arc7
210. GlassWeld4 = Instance.new("Weld", arc4)
211. GlassWeld4.Part0 = arc4
212. GlassWeld4.Part1 = arc8
213. arc.Material = "Neon"
214. arc2.Material = "Neon"
215. arc3.Material = "Neon"
216. arc4.Material = "Neon"
217. arc.Color = Color3.fromRGB(91, 130, 2555)
218. arc2.Color = Color3.fromRGB(91, 130, 2555)
219. arc3.Color = Color3.fromRGB(91, 130, 2555)
220. arc4.Color = Color3.fromRGB(91, 130, 2555)
221. arc5.Color = Color3.fromRGB(91, 130, 255)
222. arc6.Color = Color3.fromRGB(91, 130, 255)
223. arc7.Color = Color3.fromRGB(91, 130, 255)
224. arc8.Color = Color3.fromRGB(91, 130, 255)
225. arc5.Transparency = .5
226. arc6.Transparency = .5
227. arc7.Transparency = .5
228. arc8.Transparency = .5
229. point1.CanCollide = false
230. point1.Transparency = 0
231. point2.CanCollide = false
232. point2.Transparency = 0
233. point3.CanCollide = false
234. point3.Transparency = 0
235. arc.CanCollide = false
236. arc2.CanCollide = false
237. arc3.CanCollide = false
238. arc4.CanCollide = false
239. arc5.CanCollide = false
240. arc6.CanCollide = false
241. arc7.CanCollide = false
242. arc8.CanCollide = false
243. pcall(function()
244. while true do
245. wait(0.125)
246. if on then
247. arc5.Transparency = .5
248. arc6.Transparency = .5
249. arc7.Transparency = .5
250. arc8.Transparency = .5
251. arc.Transparency = 0
252. arc2.Transparency = 0
253. arc3.Transparency = 0
254. arc4.Transparency = 0
255. local intersection = part.Position + (part2.Position - part.Position)
256. local distance = (part.Position - intersection).Magnitude
257. point1.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.25)
258. point2.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.5)
259. point3.CFrame = CFrame.new(part.Position, intersection)*CFrame.new(math.random(-2.5,2.5), math.random(-2.5,2.5), -distance * 0.75)
260. local intersection2 = part2.Position + (point3.Position - part2.Position)
261. local distance2 = (part2.Position - intersection2).Magnitude
262. arc.CFrame = CFrame.new(part2.Position, intersection2) * CFrame.new(0,0,-distance2/2)
263. arc.Size = Vector3.new(0.5,0.5,distance2)
264. local intersection3 = point3.Position + (point2.Position - point3.Position)
265. local distance3 = (point3.Position - intersection3).Magnitude
266. arc2.CFrame = CFrame.new(point3.Position, intersection3) * CFrame.new(0,0,-distance3/2)
267. arc2.Size = Vector3.new(0.5,0.5,distance3)
268. local intersection4 = point2.Position + (point1.Position - point2.Position)
269. local distance4 = (point2.Position - intersection4).Magnitude
270. arc3.CFrame = CFrame.new(point2.Position, intersection4) * CFrame.new(0,0,-distance4/2)
271. arc3.Size = Vector3.new(0.5,0.5,distance4)
272. local intersection5 = point1.Position + (part.Position - point1.Position)
273. local distance5 = (point1.Position - intersection5).Magnitude
274. arc4.CFrame = CFrame.new(point1.Position, intersection5) * CFrame.new(0,0,-distance5/2)
275. arc4.Size = Vector3.new(0.5,0.5,distance5)
276. arc5.Size = Vector3.new(0.75,0.75,distance2 + 0.25)
277. arc6.Size = Vector3.new(0.75,0.75,distance3 + 0.25)
278. arc7.Size = Vector3.new(0.75,0.75,distance4 + 0.25)
279. arc8.Size = Vector3.new(0.75,0.75,distance5 + 0.25)
280. else
281. arc5.Transparency = 1
282. arc6.Transparency = 1
283. arc7.Transparency = 1
284. arc8.Transparency = 1
285. arc.Transparency = 1
286. arc2.Transparency = 1
287. arc3.Transparency = 1
288. arc4.Transparency = 1
289. end
290. end
291. end)
292. end)()
293. end
294. the()
295. the2()