Advertisement
supreim

Untitled

Jan 24th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.88 KB | None | 0 0
  1. Modelname = "Staff Of Disasterous Explosions"
  2. Toolname = "Staff Of Disasterous Explosions"
  3. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  4. local Selected = false
  5. local inuse = false
  6. local mousedown = false
  7. local Character = nil
  8.  
  9. function Execute(f)
  10. return coroutine.resume(coroutine.create(function()f()end))
  11. end
  12.  
  13. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  14. local p = Instance.new("Part")
  15. p.formFactor = "Custom"
  16. p.Anchored = Anchor
  17. p.CanCollide = Collide
  18. p.Transparency = Tran
  19. p.Reflectance = Ref
  20. p.BrickColor = BrickColor.new(Color)
  21. p.Material = 272
  22.  
  23. for _, Surf in pairs(Surfaces) do
  24. p[Surf] = "Smooth"
  25. end
  26.  
  27. p.Size = Vector3.new(X, Y, Z)
  28.  
  29. if Break then
  30. p:BreakJoints()
  31. else
  32. p:MakeJoints()
  33. end
  34.  
  35. p.Parent = Parent
  36. p.Locked = true
  37.  
  38. return p
  39. end
  40.  
  41. function Weld(p0, p1, x, y, z, a, b, c)
  42. local w = Instance.new("Weld")
  43. w.Parent = p0
  44. w.Part0 = p0
  45. w.Part1 = p1
  46. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  47. return w
  48. end
  49.  
  50. Add = {
  51. Sphere = function(P)
  52. local m = Instance.new("SpecialMesh",P)
  53. m.MeshType = "Sphere"
  54. return m
  55. end,
  56. Mesh = function(P, ID, x, y, z)
  57. local m = Instance.new("SpecialMesh")
  58. m.MeshId = ID
  59. m.Scale = Vector3.new(x, y, z)
  60. m.Parent = P
  61. return m
  62. end,
  63. Sound = function(P, ID, vol, pitch)
  64. local s = Instance.new("Sound")
  65. s.SoundId = ID
  66. s.Volume = vol
  67. s.Pitch = pitch
  68. s.Parent = P
  69. return s
  70. end
  71. }
  72.  
  73.  
  74. local Model,handle,toptip,bottip,HB,HW,TH,HBW,Crystal
  75. local player = game.Players.supreim
  76. local StaffModel = nil
  77. local Rarm = nil
  78. local RABrick, RABW, RAW
  79.  
  80. function GenerateModel(Parent,Torso,Rarm)
  81. Model = Instance.new("Model")
  82. Model.Name = Modelname
  83. handle = Part(Model, false, false, 0, 0, "Brown", 0.3, 4.4, 0.3, true)
  84. handle.Name = "Handle"
  85. Instance.new("CylinderMesh",handle)
  86. toptip = Part(Model, false, false, 0, 0, "Brown", 0.6, 0.2, 0.6, true)
  87. Weld(handle, toptip, 0, -2, 0, 0, 0, 0)
  88. Instance.new("CylinderMesh",toptip)
  89. Crystal = Part(Model, false, false, 0, 0.2, "Bright blue", 0.5, 0.75, 0.5, true)
  90. local w1 = Weld(handle, Crystal, 0, -2.2, 0, 0, 0, 0)
  91. Add.Mesh(Crystal, "http://www.roblox.com/asset/?id=9756362", 0.5, 0.75, 0.5)
  92. Crystal.Reflectance = 0.25
  93. Crystal.Transparency = 0.25
  94. local BotTip = Part(Model, false, false, 0, 0, "Brown", 0.2, 1.5, 0.2, true)
  95. local w1 = Weld(handle, BotTip, 0, 2.15, 0, 0, 0, 0)
  96. Add.Mesh(BotTip, "http://www.roblox.com/asset/?id=9756362", 0.4, 0.7, 0.4)
  97. Model.Parent = Parent
  98. StaffModel = Model
  99.  
  100. RABrick = Part(Model, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  101. RABW = Weld(Torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  102. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  103.  
  104. HB = Part(Model, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  105. HBW = Weld(Rarm, HB, 0, 1, -1.5, 0, 0, 0)
  106. HW = Weld(HB, nil, 0, -1.3, 0, math.pi/2, 0, 0)
  107. TH = Weld(Torso, nil, -0.6, 0.1, 0, 0, math.pi/2, math.rad(-140))
  108. TH.Part1 = handle
  109.  
  110. end
  111.  
  112. local tool = nil
  113. function GenerateTool()
  114. if player:IsA("Player") then
  115. if player.Character ~= nil then
  116. if player.Character:FindFirstChild("Torso") ~= nil then
  117. if player.Character:FindFirstChild(Modelname) == nil then
  118. if player.Character:FindFirstChild("Right Arm") then
  119. GenerateModel(player.Character,player.Character:FindFirstChild("Torso"),player.Character:FindFirstChild("Right Arm"))
  120. Rarm = player.Character:FindFirstChild("Right Arm")
  121. Character = player.Character
  122. end
  123. else
  124. StaffModel = player.Character:FindFirstChild(Modelname)
  125. end
  126. if player.Character:FindFirstChild(Modelname) ~= nil then
  127. if player.Backpack:FindFirstChild(Toolname) == nil then
  128. tool = Instance.new("HopperBin",player.Backpack)
  129. tool.Name = Toolname
  130. wait()
  131. script.Parent = tool
  132. end
  133. end
  134. end
  135. end
  136. end
  137. end
  138.  
  139. function ToolAnimSelect()
  140. RAW.Part1 = Rarm
  141. local ah = CFrame.Angles(0, 0, math.rad(90))
  142. RAW.Part1 = Rarm
  143. for i = 0, 270, 270/5 do
  144. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  145. wait()
  146. end
  147. HW.C0 = ah
  148. TH.Part1 = nil
  149. HW.Part1 = handle
  150. for i = 270, 70, -200/5 do
  151. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  152. wait()
  153. end
  154. RAW.C0 = CFrame.new(0, 0, -70/500) * CFrame.Angles(70,0,0)
  155. inuse = false
  156. end
  157.  
  158. function ToolAnimUnSelect()
  159. RAW.Part1 = Rarm
  160. local ah = CFrame.Angles(0, 0, math.rad(90))
  161. for i = 70, 270, 200/5 do
  162. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  163. wait()
  164. end
  165. HW.C0 = ah
  166. HW.Part1 = nil
  167. TH.Part1 = handle
  168. for i = 270, 0, -270/5 do
  169. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  170. wait()
  171. end
  172. RAW.Part1 = nil
  173. inuse = false
  174. end
  175.  
  176. function prop(part, parent, collide, tran, ref, x, y, z, color)
  177. part.Parent = parent
  178. part.formFactor = 3
  179. part.Anchored = true
  180. part.CanCollide = collide
  181. part.Transparency = tran
  182. part.Reflectance = ref
  183. part.Material = 288
  184. part.Size = Vector3.new(x,y,z)
  185. part.BrickColor = BrickColor.new(color)
  186. part.TopSurface = 0
  187. part.BottomSurface = 0
  188. part:BreakJoints()
  189. end
  190.  
  191. local a,b,c -- explosion
  192. function Selected(mouse)
  193. if inuse == false then
  194. inuse = true
  195. ToolAnimSelect()
  196. Selected = true
  197. end
  198. if Selected == true then
  199. mouse.Button1Down:connect(function()
  200. mousedown = true
  201. while mousedown do
  202. if Character:FindFirstChild("Humanoid") ~= nil then
  203. if Character:FindFirstChild("Humanoid").Health > 0 then
  204. if Character:FindFirstChild("ForceField") == nil then
  205. c = Instance.new("ForceField",Character)
  206. end
  207. b = Instance.new("Part")
  208. prop(b, Character, false, 0.4, 0.25, 0.05, 0.05, (Crystal.Position - mouse.hit.p).magnitude, "Cyan")
  209. b.CFrame = CFrame.new(Crystal.Position, mouse.hit.p) * CFrame.new(0,0,-b.Size.Z/2)
  210. local ex = Instance.new("Explosion")
  211. ex.Parent = Character
  212. ex.DestroyJointRadiusPercent = 1
  213. ex.ExplosionType = 2
  214. ex.Position = mouse.hit.p
  215. ex.BlastRadius = 5
  216. ex.BlastPressure = 100000
  217. game:GetService("Debris"):AddItem(b,.25)
  218. end
  219. end
  220. wait(0.1)
  221.  
  222. end
  223. end)
  224. mouse.Button1Up:connect(function()
  225. if Character:FindFirstChild("ForceField") ~= nil then
  226. game:GetService("Debris"):AddItem(Character:FindFirstChild("ForceField"),.5)
  227. end
  228. mousedown = false
  229. end)
  230. end
  231. end
  232.  
  233.  
  234.  
  235.  
  236. function UnSelected()
  237. if inuse == false then
  238. if Character:FindFirstChild("ForceField") ~= nil then
  239. game:GetService("Debris"):AddItem(Character:FindFirstChild("ForceField"),.5)
  240. end
  241. mousedown = false
  242. inuse = true
  243. ToolAnimUnSelect()
  244. HW.Part1 = nil
  245. TH.Part1 = handle
  246. Selected = false
  247. end
  248. end
  249.  
  250. GenerateTool()
  251.  
  252. if tool ~= nil then
  253. tool.Selected:connect(Selected)
  254. tool.Deselected:connect(UnSelected)
  255. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement