Advertisement
Animescapetower

Flea Staff

Mar 18th, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.68 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. SpecialMesh1 = Instance.new("SpecialMesh")
  21. Script2 = Instance.new("Script")
  22. Part3 = Instance.new("Part")
  23. SpecialMesh4 = Instance.new("SpecialMesh")
  24. Script5 = Instance.new("Script")
  25. Script6 = Instance.new("Script")
  26. Tool0.Name = "Tornado"
  27. Tool0.Parent = mas
  28. Tool0.TextureId = "http://www.roblox.com/asset/?id=102604215"
  29. Tool0.Enabled = false
  30. Tool0.GripForward = Vector3.new(-4.37113883e-08, -0, -1)
  31. Tool0.GripPos = Vector3.new(0, -1.5, 0)
  32. Tool0.GripRight = Vector3.new(1, 0, -4.37113883e-08)
  33. SpecialMesh1.Name = "TornadoMesh"
  34. SpecialMesh1.Parent = Tool0
  35. SpecialMesh1.MeshId = "http://www.roblox.com/asset/?id=102638417"
  36. SpecialMesh1.Scale = Vector3.new(5, 7, 5)
  37. SpecialMesh1.TextureId = "http://www.roblox.com/asset/?id=102638520"
  38. SpecialMesh1.MeshType = Enum.MeshType.FileMesh
  39. SpecialMesh1.Scale = Vector3.new(5, 7, 5)
  40. Script2.Parent = Tool0
  41. table.insert(cors,sandbox(Script2,function()
  42. function WaitForChild(parent, child)
  43. while not parent:FindFirstChild(child) do parent.ChildAdded:wait() end
  44. return parent[child]
  45. end
  46.  
  47. local NUM_TORNADOS = 12
  48. local TORNADO_SPEED = 43
  49. local TORNADO_DURATION = 7
  50. local TORNADO_WOBBLE_ANGLE = 54 --1.5
  51. local TORNADO_SPIN_SPEED = 43
  52. local TORNADO_SIZE = Vector3.new(6, 10, 6)
  53. local TORNADO_DAMAGE = "Inf"
  54.  
  55. local Tool = script.Parent
  56. local Handle = WaitForChild(Tool, "Handle")
  57. local TornadoMesh = WaitForChild(Tool, "TornadoMesh")
  58.  
  59. -- now that we're in game, split staff into two parts, with top part floatin' around:
  60. -- partial staff meshes:
  61. -- top: 102605108
  62. -- bottom: 102605081
  63. local StaffMesh = WaitForChild(Handle, "Mesh")
  64. StaffMesh.MeshId = "http://www.roblox.com/asset/?id=102605081"
  65.  
  66. local FloatyBall = Instance.new("Part")
  67. FloatyBall.formFactor = "Custom"
  68. FloatyBall.Size = Vector3.new(.2, .2, .2)
  69. FloatyBall.CanCollide = false
  70.  
  71. local FloatyBallMesh = StaffMesh:Clone()
  72. FloatyBallMesh.MeshId = "http://www.roblox.com/asset/?id=102605108"
  73. FloatyBallMesh.Parent = FloatyBall
  74.  
  75. local FloatyBallWeld = Instance.new("ManualWeld")
  76. FloatyBallWeld.Part0 = Handle
  77. FloatyBallWeld.Part1 = FloatyBall
  78. FloatyBallWeld.C0 = CFrame.new()
  79. FloatyBallWeld.C1 = CFrame.new() + Vector3.new(0, 1, 0)
  80. FloatyBallWeld.Parent = FloatyBall
  81.  
  82. function AnimateFloatyBall()
  83. local timeParam1 = 0
  84. local timeParam2 = 0
  85. local timeIncrement
  86. local rotatedCF
  87. while true do
  88. rotatedCF = CFrame.Angles(0, 0, timeParam2)
  89. FloatyBallWeld.C1 = rotatedCF + rotatedCF:vectorToWorldSpace(Vector3.new(0, -3 + .5 * math.sin(timeParam1), 0))
  90. timeIncrement = wait(.01)
  91. if not Tool.Enabled then
  92. timeParam2 = timeParam2 + 8 * timeIncrement
  93. else
  94. timeParam2 = timeParam2 + timeIncrement
  95. end
  96. timeParam1 = timeParam1 + timeIncrement
  97. if timeParam2 > math.pi*12 then
  98. timeParam2 = timeParam2 - math.pi*12
  99. end
  100. if timeParam1 > math.pi*12 then
  101. timeParam1 = timeParam1 - math.pi*12
  102. end
  103. end
  104. end
  105.  
  106.  
  107. -- animate floaty ball all the timez
  108. coroutine.resume(coroutine.create(AnimateFloatyBall))
  109.  
  110. -- make tornado part
  111. TornadoPrototype = Instance.new("Part")
  112. TornadoPrototype.formFactor = "Custom"
  113. TornadoPrototype.Size = Vector3.new(.2, .2, .2)
  114. TornadoPrototype.Material = Enum.Material.Neon
  115. TornadoPrototype.BrickColor = BrickColor.Black()
  116. TornadoPrototype.TopSurface = "Smooth"
  117. TornadoPrototype.BottomSurface = "Smooth"
  118. TornadoPrototype.CanCollide = false
  119. --trails and stuff
  120.  
  121.  
  122.  
  123. -- give it mesh
  124.  
  125.  
  126.  
  127. -- float it
  128. local TornadoFloatForce = Instance.new("BodyForce")
  129. TornadoFloatForce.force = Vector3.new(0, TornadoPrototype:GetMass()*196.2, 0)
  130. TornadoFloatForce.Parent = TornadoPrototype
  131.  
  132. -- rotate it
  133. local TornadoRotate = Instance.new("BodyAngularVelocity")
  134. TornadoRotate.P = 20
  135. TornadoRotate.maxTorque = TornadoRotate.P * Vector3.new(0, 1, 0)
  136. TornadoRotate.angularvelocity = Vector3.new(0, 0, 0)
  137. TornadoRotate.Parent = TornadoPrototype
  138.  
  139. -- make it move (but not in the y-axis)
  140. local TornadoVelocity = Instance.new("BodyVelocity")
  141. TornadoVelocity.P = 20
  142. TornadoVelocity.maxForce = TornadoVelocity.P * Vector3.new(1, 0, 1)
  143. TornadoVelocity.velocity = Vector3.new(0, 0, 0)
  144. TornadoVelocity.Parent = TornadoPrototype
  145.  
  146. -- noisy stormz
  147. local StormSound = Instance.new("Sound")
  148. StormSound.Name = "StormSound"
  149. StormSound.SoundId = "http://www.roblox.com/asset/?id=101173442"
  150. StormSound.Parent = TornadoPrototype
  151. StormSound.Volume = 1
  152.  
  153. function tagHumanoid(humanoid, player)
  154. local creator_tag = Instance.new("ObjectValue")
  155. creator_tag.Value = player
  156. creator_tag.Name = "creator"
  157. creator_tag.Parent = humanoid
  158. game.Debris:AddItem(creator_tag, 1)
  159. end
  160.  
  161.  
  162. function applyUpwardsForce(part, tornadoVelocity, upwardsForces)
  163. if upwardsForces[part] then return end
  164. upwardsForces[part] = true
  165.  
  166. local newFloatForce = Instance.new("BodyForce")
  167. newFloatForce.force = Vector3.new(0, 300*part:GetMass(), 0) + tornadoVelocity * part:GetMass() * Vector3.new(10, 0, 10)
  168. newFloatForce.Parent = part
  169.  
  170. game:GetService("Debris"):AddItem(newFloatForce, .25)
  171. end
  172.  
  173. function damageChar(part, humanoidsDamaged, playerDamaging)
  174. local char = part.Parent
  175. if not char then return end
  176. local hum = char:FindFirstChild("Humanoid")
  177. if not hum then
  178. char = char.Parent
  179. hum = char:FindFirstChild("Humanoid")
  180. if not hum then return end
  181. end
  182. if humanoidsDamaged[hum] then return end
  183. humanoidsDamaged[hum] = true
  184. if hum.Health > 0 then
  185. hum:TakeDamage(TORNADO_DAMAGE)
  186. tagHumanoid(hum, playerDamaging)
  187. end
  188. end
  189.  
  190. function checkPartsHit(position, character, tornadoVelocity)
  191. local partsHit = workspace:FindPartsInRegion3(Region3.new(position - TORNADO_SIZE/2, position + TORNADO_SIZE/2), character)
  192. local humanoidsDamaged = {}
  193. local upwardsForces = {}
  194. local playerDamaging = game.Players:GetPlayerFromCharacter(character)
  195. for i = 1, #partsHit do
  196. if not partsHit[i].Anchored and partsHit[i].CanCollide then
  197. -- apply upwards force?
  198. applyUpwardsForce(partsHit[i], tornadoVelocity, upwardsForces)
  199. damageChar(partsHit[i], humanoidsDamaged, playerDamaging)
  200. end
  201. end
  202. end
  203.  
  204. function handleTornado(tornado, character)
  205. local tornadoForce = tornado.BodyVelocity
  206. local randomAngle, rotateCF, newVelocity
  207.  
  208. -- play storm sound
  209. tornado["StormSound"]:Play()
  210.  
  211. for i = 0, TORNADO_DURATION, .25 do
  212. -- handle motion per tick
  213. randomAngle = (math.random()-.5) * TORNADO_WOBBLE_ANGLE
  214. rotateCF = CFrame.Angles(0, randomAngle, 0)
  215. newVelocity = rotateCF:vectorToWorldSpace(tornadoForce.velocity)
  216. tornadoForce.velocity = newVelocity
  217.  
  218. -- handle interactions per tick
  219. checkPartsHit(tornado.CFrame.p, character, newVelocity)
  220.  
  221. wait(.25)
  222. end
  223. tornado:Remove()
  224. end
  225.  
  226. function makeTornado(startPoint, targetPoint, character)
  227. local newTornado = TornadoPrototype:Clone()
  228. newTornado.CFrame = CFrame.new(startPoint, targetPoint)
  229. newTornado.BodyVelocity.velocity = (targetPoint - startPoint).unit * TORNADO_SPEED
  230. newTornado.BodyAngularVelocity.angularvelocity = Vector3.new(0, TORNADO_SPIN_SPEED, 0)
  231. newTornado.Parent = workspace
  232.  
  233. coroutine.resume(coroutine.create(handleTornado), newTornado, character)
  234. end
  235.  
  236.  
  237. Tool.Enabled = true
  238. function onActivated()
  239.  
  240. local Character = Tool.Parent
  241. if not Character then return end
  242.  
  243. local Torso = Character:FindFirstChild("Torso")
  244. local Humanoid = Character:FindFirstChild("Humanoid")
  245. if (not Torso) or (not Humanoid) then return end
  246.  
  247. if not Tool.Enabled then return end
  248. Tool.Enabled = false
  249.  
  250. wait()
  251.  
  252. local torsoPoint = Torso.CFrame.p + Vector3.new(0, 2, 0) -- little above torso
  253. local targetPoint = Humanoid.TargetPoint * Vector3.new(1, 0, 1) + torsoPoint * Vector3.new(0, 1, 0)
  254.  
  255. for i = 1, NUM_TORNADOS do
  256. makeTornado(torsoPoint, targetPoint, Character)
  257. end
  258.  
  259. wait(3.5)
  260.  
  261. Tool.Enabled = true
  262. end
  263.  
  264. function onEquipped()
  265. FloatyBallWeld.Parent = FloatyBall
  266. FloatyBall.Parent = Tool.Parent
  267. end
  268.  
  269. function onUnequipped()
  270. FloatyBallWeld.Parent = FloatyBall
  271. FloatyBall.Parent = Handle.Parent
  272. end
  273.  
  274. Tool.Activated:connect(onActivated)
  275. Tool.Equipped:connect(onEquipped)
  276. Tool.Unequipped:connect(onUnequipped)
  277.  
  278. end))
  279. Part3.Name = "Handle"
  280. Part3.Parent = Tool0
  281. Part3.Rotation = Vector3.new(0, 0, -42.4799995)
  282. Part3.Locked = true
  283. Part3.FormFactor = Enum.FormFactor.Custom
  284. Part3.Size = Vector3.new(1.02999997, 5.16999626, 0.400000006)
  285. Part3.CFrame = CFrame.new(7.97200203, 2.254179, -36.0029373, 0.737470388, 0.675379276, 0, -0.675379276, 0.737470388, 0, 0, 0, 1)
  286. Part3.BottomSurface = Enum.SurfaceType.Smooth
  287. Part3.TopSurface = Enum.SurfaceType.Smooth
  288. Part3.Position = Vector3.new(7.97200203, 2.254179, -36.0029373)
  289. Part3.Orientation = Vector3.new(0, 0, -42.4799995)
  290. SpecialMesh4.Parent = Part3
  291. SpecialMesh4.MeshId = "http://www.roblox.com/asset/?id=102604853"
  292. SpecialMesh4.Scale = Vector3.new(2.20000005, 2.20000005, 2.20000005)
  293. SpecialMesh4.TextureId = "http://www.roblox.com/asset/?id=102604283"
  294. SpecialMesh4.MeshType = Enum.MeshType.FileMesh
  295. SpecialMesh4.Scale = Vector3.new(2.20000005, 2.20000005, 2.20000005)
  296. Script5.Name = "SwordScript"
  297. Script5.Parent = Tool0
  298. table.insert(cors,sandbox(Script5,function()
  299. local animations = {"45913583"}
  300. local tool = script.Parent
  301. local enabled = true
  302. local char
  303.  
  304. tool.Activated:connect(function()
  305. if enabled then
  306. enabled = false
  307. local char = tool.Parent
  308. local random = animations[math.random(1,#animations)]
  309.  
  310. local anim = Instance.new("Animation")
  311. anim.AnimationId = "http://www.roblox.com/asset/?id="..random
  312.  
  313. local track = char.Humanoid:LoadAnimation(anim)
  314. track:Play()
  315.  
  316. local dmg = script.Damage:Clone()
  317. dmg.Parent = tool.Handle
  318. dmg.Disabled = false
  319. wait(3.5)
  320.  
  321. enabled = true
  322. if dmg then
  323. dmg:Destroy()
  324. end
  325. end
  326. end)
  327. end))
  328. Script6.Name = "Damage"
  329. Script6.Parent = Script5
  330. Script6.Disabled = true
  331. table.insert(cors,sandbox(Script6,function()
  332. local weapon = script.Parent
  333. local dmg = math.random(1,30) -- 1 = minimum damage,30 = maximum damage; if u just want it to be just
  334. --1 constant damage,make it like this: "local dmg = 30" (without the double quotes
  335.  
  336. weapon.Touched:connect(function(part)
  337. if part.Parent:findFirstChild("Humanoid") then
  338. local humanoid = part.Parent:findFirstChild("Humanoid")
  339. humanoid:TakeDamage(dmg)
  340. script:Destroy()
  341. end
  342. end)
  343. end))
  344. for i,v in pairs(mas:GetChildren()) do
  345. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  346. pcall(function() v:MakeJoints() end)
  347. end
  348. mas:Destroy()
  349. for i,v in pairs(cors) do
  350. spawn(function()
  351. pcall(v)
  352. end)
  353. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement