codemen

Electric ball script [roblox]

Nov 12th, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.97 KB | None | 0 0
  1. Player = game.Players.LocalPlayer
  2. Character = Player.Character
  3. script.Parent = Character
  4.  
  5. --[[ * Fire StickA * ]]--
  6.  
  7. pcall(function() Character.Staff:Remove() end)
  8.  
  9. Staff = Instance.new("Model")
  10. Staff.Name = "Staff"
  11. Staff.Parent = Character
  12.  
  13. Lightning = Instance.new("Model")
  14. Lightning.Name = "Lightning"
  15. Lightning.Parent = Staff
  16.  
  17. --[[ * Arm Weld * ]]--
  18.  
  19. ArmWeld = Instance.new("Weld")
  20. ArmWeld.Parent = Character["Torso"]
  21. ArmWeld.Part0 = ArmWeld.Parent
  22. ArmWeld.Part1 = Character["Right Arm"]
  23. ArmWeld.C0 = CFrame.new(1.5,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  24.  
  25. --[[ * Arm Weld * ]]--
  26.  
  27. ArmWeldR = Instance.new("Weld")
  28. ArmWeldR.Parent = Character["Torso"]
  29. ArmWeldR.Part0 = ArmWeldR.Parent
  30. ArmWeldR.Part1 = Character["Left Arm"]
  31. ArmWeldR.C0 = CFrame.new(-1.5,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  32.  
  33. --[[ * Neck Weld * ]]--
  34.  
  35. Neck = Instance.new("Weld")
  36. Neck.Parent = Character["Torso"]
  37. Neck.Part0 = Neck.Parent
  38. Neck.Part1 = Character["Head"]
  39. Neck.C0 = CFrame.new(0,1.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  40.  
  41. --[[ * StickA * ]]--
  42.  
  43. StickA = Instance.new("Part")
  44. StickA.formFactor = "Custom"
  45. StickA.Locked = true
  46. StickA.CanCollide = false
  47. StickA.BrickColor = BrickColor.new("Navy blue")
  48. StickA.Reflectance = 1
  49. StickA.Anchored = false
  50. StickA.Size = Vector3.new(1,1,1)
  51. StickA.TopSurface = 0
  52. StickA.BottomSurface = 0
  53. StickA.Parent = Staff
  54. MeshA = Instance.new("SpecialMesh",StickA)
  55. MeshA.MeshType = "Sphere"
  56. WeldA = Instance.new("Weld")
  57. WeldA.Parent = StickA
  58. WeldA.Part0 = Character["Right Arm"]
  59. WeldA.Part1 = StickA
  60. WeldA.C0 = CFrame.new(0,-1,-0) * CFrame.Angles(-math.pi/2,0,0)
  61. GyroA = Instance.new("BodyGyro",Character.Torso)
  62. GyroA.maxTorque = Vector3.new(0,0,0)
  63. GyroA.P = GyroA.P*10
  64. VelA = Instance.new("BodyVelocity",Character.Torso)
  65. VelA.P = VelA.P*2
  66. VelA.maxForce = Vector3.new(0,0,0)
  67. SpaB = Instance.new("Sparkles",StickA)
  68. SpaB.Enabled = false
  69. --[[ * Spark * ]]--
  70.  
  71. function spark(A,B)
  72. Hit = A.CFrame
  73. local P = Instance.new("Part")
  74. P.Name = "Guideline"
  75. local Place0 = B.CFrame
  76. P.formFactor = 0
  77. P.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  78. P.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  79. P.Parent = Lightning
  80. P.BrickColor = BrickColor.Black()
  81. P.Anchored = true
  82. P.CanCollide = false
  83. P.Transparency = 1
  84. m = Instance.new("BlockMesh")
  85. m.Scale = Vector3.new(0.1,0.1,1)
  86. m.Parent = P
  87. mh = A.CFrame
  88. for c1 = 1, 1 do
  89. oldHit = B.CFrame
  90. for count = 1, 10 do
  91. val1 = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
  92. val2 = P.Size.z / 10
  93. val3 = P.CFrame.lookVector * -1
  94. val4 = count * val2
  95. val5 = val4 * val3
  96. val6 = B.CFrame.p
  97. Hit = CFrame.new(val5 + val1 + val6)
  98. local s = Instance.new("Part")
  99. s.Name = "Spark"
  100. local Place0 = oldHit
  101. s.formFactor = 0
  102. s.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  103. s.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  104. s.Parent = Lightning
  105. s.BrickColor = BrickColor.White()
  106. s.Anchored = true
  107. s.CanCollide = false
  108. m = Instance.new("BlockMesh")
  109. m.Scale = Vector3.new(0.1,0.1,1)
  110. m.Parent = s
  111. clone = s:clone()
  112. clone.Mesh.Scale = Vector3.new(0.3,0.3,1.1)
  113. clone.BrickColor = BrickColor.Blue()
  114. clone.Transparency = 0.8
  115. clone.Parent = s.Parent
  116. oldHit = Hit
  117. end
  118. Hit = oldHit
  119. local s = Instance.new("Part")
  120. s.Name = "Spark"
  121. local Place0 = mh
  122. s.formFactor = 0
  123. s.Size = Vector3.new(1,1,(Place0.p - Hit.p).magnitude)
  124. s.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
  125. s.Parent = Lightning
  126. s.BrickColor = BrickColor.White()
  127. s.Anchored = true
  128. s.CanCollide = false
  129. m = Instance.new("BlockMesh")
  130. m.Scale = Vector3.new(0.1,0.1,1)
  131. m.Parent = s
  132. clone = s:clone()
  133. clone.Mesh.Scale = Vector3.new(0.3,0.3,1.1)
  134. clone.BrickColor = BrickColor.Blue()
  135. clone.Transparency = 0.8
  136. clone.Parent = s.Parent
  137. wait(0.5)
  138. end
  139. P:remove()
  140. end
  141.  
  142. function PlaceL(BB)
  143. coroutine.resume(coroutine.create(function()
  144. local PA = Instance.new("Part")
  145. PA.Anchored = true
  146. PA.Locked = true
  147. PA.CanCollide = false
  148. PA.Transparency = 1
  149. PA.Size = Vector3.new(0.1,0.1,0.1)
  150. PA.Parent = Lightning
  151. PA.CFrame = CFrame.new(BB.x,BB.y,BB.z)
  152. spark(StickA,PA)
  153. for i = 1,10 do wait()
  154. for i,v in pairs(Lightning:GetChildren()) do
  155. if v:IsA("Part") then
  156. v.Transparency = v.Transparency + 0.1
  157. end
  158. end
  159. end
  160. for i,v in pairs(Lightning:GetChildren()) do
  161. if v:IsA("Part") then
  162. v:Remove()
  163. end
  164. end
  165. end))
  166. end
  167.  
  168. --[[ * Tool * ]]--
  169.  
  170. if script.Parent.Name == Player.Name then
  171. Hopper = Instance.new("HopperBin")
  172. Hopper.Name = "Staff"
  173. Hopper.Parent = Player.Backpack
  174. end
  175.  
  176. Blah = true
  177. StaffOn = false
  178. StaffStuff = false
  179. Flying = false
  180. Lighter = false
  181.  
  182. function Clicked(Mouse)
  183. if Blah == true then
  184. Blah = false
  185.  
  186. Blah = true
  187. end
  188. end
  189.  
  190. VCZ = 1
  191.  
  192. Keys = {"/","0","f"}
  193. PGyro = nil
  194. Asin = false
  195.  
  196. function onKeyDown(key,Mouse)
  197. if Blah == true then
  198. Blah = false
  199.  
  200. if key == "f" then
  201. if Lighter == false then
  202. Keys[key] = true
  203. Lighter = true
  204.  
  205. SpaB.Enabled = true
  206. while Keys[key] == true and Lighter == true do
  207. --PlaceL(Vector3.new(Character.Torso.Position.x,Character.Torso.Position.y+100,Character.Torso.Position.z))
  208. if Mouse.Target ~= nil then
  209. PlaceL(Mouse.Hit.p)
  210. Mouse.Target:BreakJoints()
  211. end
  212. wait()
  213. end
  214. end
  215. end
  216.  
  217. Blah = true
  218. return
  219. end
  220. end
  221.  
  222. function onKeyUp(key,Mouse)
  223.  
  224. if key == "f" then
  225. if Lighter == true and Keys[key] == true then
  226. Keys[key] = false
  227. Lighter = false
  228. SpaB.Enabled = false
  229. wait(1)
  230. SpaB.Enabled = false
  231. end
  232. end
  233.  
  234. end
  235.  
  236. function Selected(Mouse)
  237. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  238. Mouse.KeyDown:connect(function(key) onKeyDown(key, Mouse) end)
  239. Mouse.KeyUp:connect(function(key) onKeyUp(key, Mouse) end)
  240. Mouse.Button1Down:connect(function()Clicked(Mouse)end)
  241. for i = 1,10 do wait()
  242. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(math.pi/10/2,0,0)
  243. ArmWeld.C0 = ArmWeld.C0 - Vector3.new(0,-0.05,0.05)
  244. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2,0,0)
  245. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0,-0.05,0.05)
  246. WeldA.C0 = WeldA.C0 * CFrame.Angles(0,0,math.pi/10/2)
  247. end
  248. for i = 1,10 do wait()
  249. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,-math.pi/10/2/2)
  250. ArmWeld.C0 = ArmWeld.C0 - Vector3.new(0.05,0,0)
  251. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(0,0,math.pi/10/2/2)
  252. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(-0.05,0,0)
  253. WeldA.C0 = WeldA.C0 * CFrame.Angles(-math.pi/10/2/2,0,0)
  254. WeldA.C0 = WeldA.C0 + Vector3.new(0,-0.04,0)
  255. MeshA.Scale = MeshA.Scale + Vector3.new(0.05,0.05,0.05)
  256. end
  257. end
  258.  
  259. function Deselected(Mouse)
  260. for i = 1,10 do wait()
  261. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,math.pi/10/2/2)
  262. ArmWeld.C0 = ArmWeld.C0 + Vector3.new(0.05,0,0)
  263. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(0,0,-math.pi/10/2/2)
  264. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(-0.05,0,0)
  265. WeldA.C0 = WeldA.C0 * CFrame.Angles(math.pi/10/2/2,0,0)
  266. WeldA.C0 = WeldA.C0 - Vector3.new(0,-0.04,0)
  267. MeshA.Scale = MeshA.Scale - Vector3.new(0.05,0.05,0.05)
  268. end
  269. for i = 1,10 do wait()
  270. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(-math.pi/10/2,0,0)
  271. ArmWeld.C0 = ArmWeld.C0 + Vector3.new(0,-0.05,0.05)
  272. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2,0,0)
  273. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0,-0.05,0.05)
  274. WeldA.C0 = WeldA.C0 * CFrame.Angles(0,0,-math.pi/10/2)
  275. end
  276. end
  277.  
  278. function DeadGuy()
  279. --pcall(function() Character.Head.face:Remove() end)
  280. for i = 1,20 do
  281. for i,v in pairs(Character:GetChildren()) do
  282. if v:IsA("Part") then
  283. v.Anchored = true
  284. end
  285. end
  286. for i,v in pairs(Assassin:GetChildren()) do
  287. if v:IsA("Part") then
  288. v.Anchored = true
  289. end
  290. end
  291. for i,v in pairs(Staff:GetChildren()) do
  292. if v:IsA("Part") then
  293. v.Anchored = true
  294. end
  295. end
  296. for i,v in pairs(Lightning:GetChildren()) do
  297. if v:IsA("Part") then
  298. v.Anchored = true
  299. end
  300. end
  301. end
  302. wait(0.1)
  303. end
  304.  
  305. Hopper.Selected:connect(Selected)
  306. Hopper.Deselected:connect(Deselected)
  307. Character.Humanoid.Died:connect(DeadGuy)
  308. --[[
  309.  
  310. for i = 1,20 do wait()
  311. WeldA.C0 = WeldA.C0 * CFrame.Angles(0,0,math.pi/10)
  312. WeldB.C0 = WeldB.C0 + Vector3.new(0,0.1,0)
  313. WeldC.C0 = WeldC.C0 - Vector3.new(0,0.1,0)
  314. end
  315.  
  316. ]]
Add Comment
Please, Sign In to add comment