derekiscool423

teapot turret

Mar 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.17 KB | None | 0 0
  1. --Made by N3xul.
  2. -- Script Name: Classic Teapot Turret Reborn
  3. -- Last Updated:
  4. -- _ _ ____ _ _____ _ _
  5. -- | \ | |___ \ | | / ____| (_) | |
  6. -- | \| | __) |_ ___ _| | | (___ ___ _ __ _ _ __ | |_
  7. -- | . ` ||__ <\ \/ / | | | | \___ \ / __| '__| | '_ \| __|
  8. -- | |\ |___) |> <| |_| | | ____) | (__| | | | |_) | |_
  9. -- |_| \_|____//_/\_\\__,_|_| |_____/ \___|_| |_| .__/ \__|
  10. -- | |
  11. -- |_|
  12. local runDummyScript = function(f,scri)
  13. local oldenv = getfenv(f)
  14. local newenv = setmetatable({}, {
  15. __index = function(_, k)
  16. if k:lower() == 'script' then
  17. return scri
  18. else
  19. return oldenv[k]
  20. end
  21. end
  22. })
  23. setfenv(f, newenv)
  24. ypcall(function() f() end)
  25. end
  26. cors = {}
  27. mas = Instance.new("Model",game:GetService("Lighting"))
  28. mas.Name = "CompiledModel"
  29. o1 = Instance.new("Tool")
  30. o2 = Instance.new("Part")
  31. o3 = Instance.new("SpecialMesh")
  32. o4 = Instance.new("Sound")
  33. o5 = Instance.new("LocalScript")
  34. o6 = Instance.new("Script")
  35. o7 = Instance.new("HopperBin")
  36. o8 = Instance.new("LocalScript")
  37. o9 = Instance.new("HopperBin")
  38. o10 = Instance.new("Sound")
  39. o11 = Instance.new("LocalScript")
  40. o12 = Instance.new("HopperBin")
  41. o13 = Instance.new("Script")
  42. o14 = Instance.new("Sound")
  43. o1.Name = "GravityHammer"
  44. o1.Parent = mas
  45. o1.TextureId = "http://www.roblox.com/asset/?id=1256305"
  46. o1.GripForward = Vector3.new(-1, -0, -0)
  47. o1.GripPos = Vector3.new(0, 0, -3.25)
  48. o1.GripRight = Vector3.new(0, 1, 0)
  49. o1.GripUp = Vector3.new(0, 0, 1)
  50. o2.Name = "Handle"
  51. o2.Parent = o1
  52. o2.BrickColor = BrickColor.new("Dark stone grey")
  53. o2.Reflectance = 0.40000000596046
  54. o2.Position = Vector3.new(-7.53602743, 4.99960041, -31.5799809)
  55. o2.Rotation = Vector3.new(-90, 0.0500000007, 180)
  56. o2.FormFactor = Enum.FormFactor.Plate
  57. o2.Size = Vector3.new(1, 0.800000012, 10)
  58. o2.CFrame = CFrame.new(-7.53602743, 4.99960041, -31.5799809, -0.999999642, -7.56997451e-07, 0.000796274224, 0.000796274282, 9.09494702e-13, 0.999999702, -7.5623251e-07, 0.99999994, 6.00266503e-10)
  59. o2.BottomSurface = Enum.SurfaceType.Smooth
  60. o2.TopSurface = Enum.SurfaceType.Smooth
  61. o2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  62. o2.Position = Vector3.new(-7.53602743, 4.99960041, -31.5799809)
  63. o2.Orientation = Vector3.new(-89.9599991, 90, 90)
  64. o2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  65. o3.Parent = o2
  66. o3.MeshId = "http://www.roblox.com/asset/?id=1256290"
  67. o3.Scale = Vector3.new(0.0500000007, 0.0500000007, 0.0500000007)
  68. o3.TextureId = "http://www.roblox.com/asset/?id=1256283"
  69. o3.MeshType = Enum.MeshType.FileMesh
  70. o3.Scale = Vector3.new(0.0500000007, 0.0500000007, 0.0500000007)
  71. o4.Parent = o2
  72. o4.SoundId = "http://www.roblox.com/asset/?id=1255794"
  73. o4.Volume = 1
  74. o5.Name = "Local Gui"
  75. o5.Parent = o1
  76. table.insert(cors,coroutine.create(function()
  77. wait()
  78. runDummyScript(function()
  79.  
  80. end,o5)
  81. end))
  82. o6.Name = "SwordScript"
  83. o6.Parent = o1
  84. table.insert(cors,coroutine.create(function()
  85. wait()
  86. runDummyScript(function()
  87. -------- OMG HAX
  88.  
  89.  
  90.  
  91. r = game:service("RunService")
  92.  
  93.  
  94.  
  95.  
  96.  
  97. local damage = 5
  98.  
  99.  
  100.  
  101.  
  102.  
  103. local slash_damage = 10
  104.  
  105. local lunge_damage = 30
  106.  
  107.  
  108.  
  109. sword = script.Parent.Handle
  110.  
  111. Tool = script.Parent
  112.  
  113.  
  114.  
  115. SlashSound = sword.Sound
  116.  
  117.  
  118.  
  119. function blow(hit)
  120.  
  121. Grip = Tool.Parent["Right Arm"].RightGrip:clone()
  122.  
  123. humanoid = hit.Parent:findFirstChild("Humanoid")
  124.  
  125. if(humanoid ~= nil and humanoid.Parent.Name == Tool.Parent.Name) then --don't hit yourself
  126.  
  127. return
  128.  
  129. end
  130.  
  131.  
  132.  
  133. --if(Tool:findFirstChild("toolAnim") == nil) then return end
  134.  
  135. if(humanoid ~= nil) then --if it's a person, damage him and stop
  136.  
  137. propel(hit)
  138.  
  139. print(humanoid.Parent.Name)
  140.  
  141. humanoid.Health = humanoid.Health - 49
  142.  
  143. else
  144.  
  145. explode(hit) --explode only if it doesn't hit a person (ie, blowing holes through walls)
  146.  
  147. end
  148.  
  149.  
  150.  
  151. end
  152.  
  153.  
  154.  
  155. function propel(part)
  156.  
  157. if(part.Anchored) then return end --if it isn't anchored, make it flyyy
  158.  
  159. direction = (part.Position - Tool.Parent.Torso.Position).unit
  160.  
  161. direction = direction + Vector3.new(0,1,0)
  162.  
  163. direction = direction * 200
  164.  
  165. part.Velocity = part.Velocity + direction
  166.  
  167. end
  168.  
  169.  
  170.  
  171. debounce = true
  172.  
  173. function explode(part)
  174.  
  175. if not debounce then return end
  176.  
  177.  
  178.  
  179. debounce = false
  180.  
  181. direction = (part.Position - Tool.Parent.Torso.Position).unit
  182.  
  183. pos = direction * 12 + Tool.Parent.Torso.Position
  184.  
  185. explosion = Instance.new("Explosion")
  186.  
  187. explosion.BlastRadius = 4
  188.  
  189. explosion.BlastPressure = 1
  190.  
  191. explosion.Position = pos
  192.  
  193. explosion.Parent = game.Workspace
  194.  
  195. explosion.Hit:connect(function(part, distance) propel(part) end)
  196.  
  197. wait(.1)
  198.  
  199. Grip:clone().Parent = Tool.Parent["Right Arm"]
  200.  
  201. debounce = true
  202.  
  203. end
  204.  
  205.  
  206.  
  207. function attack()
  208.  
  209. SlashSound:play()
  210.  
  211. local anim = Instance.new("StringValue")
  212.  
  213. anim.Name = "toolanim"
  214.  
  215. anim.Value = "Slash"
  216.  
  217. anim.Parent = Tool
  218.  
  219. end
  220.  
  221.  
  222.  
  223. function lunge()
  224.  
  225. attack()
  226.  
  227. force = Instance.new("BodyPosition")
  228.  
  229. force.maxForce = Vector3.new(1e+005,1e+004,1e+005)
  230.  
  231. dir = Tool.Parent.Humanoid.targetPoint
  232.  
  233. if((dir - sword.Position).magnitude > 15) then return end
  234.  
  235. force.position = dir
  236.  
  237. force.Parent = sword
  238.  
  239. wait(.25)
  240.  
  241. force.Parent = nil
  242.  
  243. end
  244.  
  245.  
  246.  
  247. function swordUp()
  248.  
  249. Tool.GripForward = Vector3.new(-1,0,0)
  250.  
  251. Tool.GripRight = Vector3.new(0,1,0)
  252.  
  253. Tool.GripUp = Vector3.new(0,0,1)
  254.  
  255. end
  256.  
  257.  
  258.  
  259. function swordOut()
  260.  
  261. Tool.GripForward = Vector3.new(0,0,1)
  262.  
  263. Tool.GripRight = Vector3.new(0,-1,0)
  264.  
  265. Tool.GripUp = Vector3.new(-1,0,0)
  266.  
  267. end
  268.  
  269.  
  270.  
  271. function swordAcross()
  272.  
  273. -- parry
  274.  
  275. end
  276.  
  277.  
  278.  
  279.  
  280.  
  281. Tool.Enabled = true
  282.  
  283. local last_attack = 0
  284.  
  285. function onActivated()
  286.  
  287.  
  288.  
  289. if not Tool.Enabled then
  290.  
  291. return
  292.  
  293. end
  294.  
  295.  
  296.  
  297. Tool.Enabled = false
  298.  
  299.  
  300.  
  301. local character = Tool.Parent;
  302.  
  303. local humanoid = character.Humanoid
  304.  
  305. if humanoid == nil then
  306.  
  307. print("Humanoid not found")
  308.  
  309. return
  310.  
  311. end
  312.  
  313.  
  314.  
  315. t = r.Stepped:wait()
  316.  
  317. connection = sword.Touched:connect(blow)
  318.  
  319. lunge()
  320.  
  321.  
  322.  
  323. wait(.4)
  324.  
  325. connection:disconnect()
  326.  
  327. last_attack = t
  328.  
  329. Tool.Enabled = true
  330.  
  331.  
  332.  
  333.  
  334.  
  335. end
  336.  
  337. script.Parent.Activated:connect(onActivated)
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344. end,o6)
  345. end))
  346. o7.Name = "Fire Shield"
  347. o7.Parent = mas
  348. o8.Parent = o7
  349. table.insert(cors,coroutine.create(function()
  350. wait()
  351. runDummyScript(function()
  352. --clockwork
  353.  
  354. --Fix implemented by Luckymaxer
  355.  
  356. HopperBin = script.Parent
  357.  
  358. Debris = game:GetService("Debris")
  359.  
  360. function GetX(t)
  361. return 41 * math.cos(t) - 18 * math.sin(t) - 83 * math.cos(2 * t) - 11 * math.cos(3 * t) + 27 * math.sin(3 * t)
  362. end
  363.  
  364. function GetY(t)
  365. return 36 * math.cos(t) + 27 * math.sin(t) - 113 * math.cos(2 * t) + 30 * math.sin(2 * t) + 11 * math.cos(3 * t) - 27 * math.sin(3 * t)
  366. end
  367.  
  368. function GetZ(t)
  369. return 45 * math.sin(t) - 30 * math.cos(2 * t) + 113 * math.sin(2 * t) - 11 * math.cos(3 * t) + 27 * math.sin(3 * t)
  370. end
  371.  
  372. Template = Instance.new("Explosion")
  373. Template.BlastRadius = 3
  374. Template.BlastPressure = 0
  375. Template.ExplosionType = Enum.ExplosionType.NoCraters
  376.  
  377. Spaw = false
  378.  
  379. function TagHumanoid(humanoid, player)
  380. local Creator_Tag = Instance.new("ObjectValue")
  381. Creator_Tag.Name = "creator"
  382. Creator_Tag.Value = player
  383. Debris:AddItem(Creator_Tag, 2)
  384. Creator_Tag.Parent = humanoid
  385. end
  386.  
  387. function UntagHumanoid(humanoid)
  388. for i, v in pairs(humanoid:GetChildren()) do
  389. if v:IsA("ObjectValue") and v.Name == "creator" then
  390. v:Destroy()
  391. end
  392. end
  393. end
  394.  
  395. function FindCharacterAncestor(Parent)
  396. if Parent and Parent ~= game:GetService("Workspace") then
  397. local humanoid = Parent:FindFirstChild("Humanoid")
  398. if humanoid then
  399. return Parent, humanoid
  400. else
  401. return FindCharacterAncestor(Parent.Parent)
  402. end
  403. end
  404. return nil
  405. end
  406.  
  407. function ExplosionHit(Explosion)
  408. Explosion.Hit:connect(function(Hit)
  409. if Hit and Hit.Parent then
  410. local character, humanoid = FindCharacterAncestor(Hit)
  411. if character and character ~= Character and humanoid and humanoid.Health > 0 then
  412. UntagHumanoid(humanoid)
  413. TagHumanoid(humanoid, Player)
  414. Hit:BreakJoints()
  415. end
  416. end
  417. end)
  418. end
  419.  
  420. function Button1Down()
  421. Spaw = not Spaw
  422. i = 0
  423. if Spaw then
  424. while Spaw do
  425. i = (i + 0.15)
  426. local Explosion = Template:Clone()
  427. Explosion.Position = Torso.Position + Vector3.new(GetX(i) / 5, GetY(i) / 5, GetZ(i) / 5)
  428. ExplosionHit(Explosion)
  429. Explosion.Parent = game:GetService("Workspace")
  430. Explosion = Template:Clone()
  431. Explosion.Position = Torso.Position - Vector3.new(GetX(i) / 5, GetY(i) / 5, GetZ(i) / 5)
  432. ExplosionHit(Explosion)
  433. Explosion.Parent = game:GetService("Workspace")
  434. wait(0.025)
  435. end
  436. end
  437. end
  438.  
  439. function Selected(Mouse)
  440. Backpack = HopperBin.Parent
  441. Player = Backpack.Parent
  442. Character = Player.Character
  443. Humanoid = Character:FindFirstChild("Humanoid")
  444. Torso = Character:FindFirstChild("Torso")
  445. if not Player or not Character or not Humanoid or Humanoid.Health == 0 or not Torso then
  446. return
  447. end
  448. Mouse.Button1Down:connect(function()
  449. Button1Down()
  450. end)
  451. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  452. end
  453.  
  454. HopperBin.Selected:connect(Selected)
  455. end,o8)
  456. end))
  457. o9.Name = "Katon Goukakyou No Jutsu"
  458. o9.Parent = mas
  459. o10.Parent = o9
  460. o10.SoundId = "http://www.roblox.com/asset/?id=1079802"
  461. o10.Volume = 0.20000000298023
  462. o11.Parent = o9
  463. table.insert(cors,coroutine.create(function()
  464. wait()
  465. runDummyScript(function()
  466. --clockwork
  467.  
  468. --Fix implemented by Luckymaxer
  469.  
  470. HopperBin = script.Parent
  471.  
  472. Sound = HopperBin:WaitForChild("Sound")
  473.  
  474. Debris = game:GetService("Debris")
  475.  
  476. function TagHumanoid(humanoid, player)
  477. local Creator_Tag = Instance.new("ObjectValue")
  478. Creator_Tag.Name = "creator"
  479. Creator_Tag.Value = player
  480. Debris:AddItem(Creator_Tag, 2)
  481. Creator_Tag.Parent = humanoid
  482. end
  483.  
  484. function UntagHumanoid(humanoid)
  485. for i, v in pairs(humanoid:GetChildren()) do
  486. if v:IsA("ObjectValue") and v.Name == "creator" then
  487. v:Destroy()
  488. end
  489. end
  490. end
  491.  
  492. function FindCharacterAncestor(Parent)
  493. if Parent and Parent ~= game:GetService("Workspace") then
  494. local humanoid = Parent:FindFirstChild("Humanoid")
  495. if humanoid then
  496. return Parent, humanoid
  497. else
  498. return FindCharacterAncestor(Parent.Parent)
  499. end
  500. end
  501. return nil
  502. end
  503.  
  504. function ExplosionHit(Explosion)
  505. Explosion.Hit:connect(function(Hit)
  506. if Hit and Hit.Parent then
  507. local character, humanoid = FindCharacterAncestor(Hit)
  508. if character and character ~= Character and humanoid and humanoid.Health > 0 then
  509. UntagHumanoid(humanoid)
  510. TagHumanoid(humanoid, Player)
  511. Hit:BreakJoints()
  512. end
  513. end
  514. end)
  515. end
  516.  
  517. function Explode(Position)
  518. local Explosion = Instance.new("Explosion")
  519. Explosion.BlastRadius = 10
  520. Explosion.BlastPressure = 0
  521. Explosion.ExplosionType = Enum.ExplosionType.NoCraters
  522. Explosion.Position = Position
  523. ExplosionHit(Explosion)
  524. Explosion.Parent = game:GetService("Workspace")
  525. end
  526.  
  527. function Button1Down(Mouse)
  528. local StartPos = Head.Position
  529. local Delta = Mouse.Hit.p - StartPos
  530. local Unit = Delta.unit
  531. Sound:Play()
  532. for i = 0, 75 do
  533. Explode(StartPos + Unit * 20 + i * Unit * i / 25)
  534. wait(0.05)
  535. end
  536. end
  537.  
  538. function Selected(Mouse)
  539. Backpack = HopperBin.Parent
  540. Player = Backpack.Parent
  541. Character = Player.Character
  542. Humanoid = Character:FindFirstChild("Humanoid")
  543. Head = Character:FindFirstChild("Head")
  544. if not Player or not Character or not Humanoid or Humanoid.Health == 0 or not Head then
  545. return
  546. end
  547. Mouse.Button1Down:connect(function()
  548. Button1Down(Mouse)
  549. end)
  550. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  551. end
  552.  
  553. HopperBin.Selected:connect(Selected)
  554. end,o11)
  555. end))
  556. o12.Name = "SpinFire"
  557. o12.Parent = mas
  558. o13.Parent = o12
  559. table.insert(cors,coroutine.create(function()
  560. wait()
  561. runDummyScript(function()
  562. --clockwork
  563.  
  564.  
  565.  
  566. local bin = script.Parent
  567.  
  568. sfx = bin.Sound
  569.  
  570.  
  571.  
  572. function explode(pos)
  573.  
  574. local lol = Instance.new("Explosion")
  575.  
  576. lol.BlastRadius = 2
  577.  
  578. lol.BlastPressure = 1000000
  579.  
  580. lol.Position = pos
  581.  
  582. lol.Parent = game.Workspace
  583.  
  584. end
  585.  
  586.  
  587.  
  588. function onButton1Down(mouse)
  589.  
  590. local player = game.Players.LocalPlayer
  591.  
  592. if player == nil then return end
  593.  
  594. print("trigger")
  595.  
  596. -- find the best cf
  597.  
  598.  
  599.  
  600. sfx:play()
  601.  
  602. look = CFrame.new(player.Character.Head.Position,mouse.Hit.p)
  603.  
  604. for i=0,75 do
  605.  
  606. x = math.sin(i / 3) * 8 * (75 - i) / 75
  607.  
  608. y = math.cos(i / 3) * 8 * (75 - i) / 75
  609.  
  610. helix = look * CFrame.new(x,y,-i)
  611.  
  612.  
  613.  
  614. explode(helix.p)
  615.  
  616.  
  617.  
  618. x = -math.sin(i / 3) * 8 * (75 - i) / 75
  619.  
  620. y = -math.cos(i / 3) * 8 * (75 - i) / 75
  621.  
  622. helix = look * CFrame.new(x,y,-i)
  623.  
  624.  
  625.  
  626. explode(helix.p)
  627.  
  628. wait(.02)
  629.  
  630. end
  631.  
  632. sfx:pause()
  633.  
  634. end
  635.  
  636.  
  637.  
  638. function onSelected(mouse)
  639.  
  640. print("select")
  641.  
  642. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  643.  
  644. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  645.  
  646. end
  647.  
  648.  
  649.  
  650. bin.Selected:connect(onSelected)
  651.  
  652.  
  653. end,o13)
  654. end))
  655. o14.Parent = o12
  656. o14.SoundId = "http://www.roblox.com/asset/?id=12222095"
  657. o14.Volume = 0.60000002384186
  658. mas.Parent = workspace
  659. mas:MakeJoints()
  660. local mas1 = mas:GetChildren()
  661. for i=1,#mas1 do
  662. mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
  663. ypcall(function() mas1[i]:MakeJoints() end)
  664. end
  665. mas:Destroy()
  666. for i=1,#cors do
  667. coroutine.resume(cors[i])
  668. end
  669. --Forcefield
  670. local f = Instance.new("ForceField")
  671. f.Parent = game.Players.localPlayer.Character
  672. --Teapot
  673. hat = Instance.new'Accessory'
  674. hat.Name = 'GoldTeapot'
  675. hat.AttachmentForward = Vector3.new(0,0,-1)
  676. hat.AttachmentPos = Vector3.new(0, 0.300000012, 0)
  677. hat.AttachmentUp = Vector3.new(0, 1, 0)
  678. hat.AttachmentRight = Vector3.new(1, 0, 0)
  679. handle = Instance.new('Part', hat)
  680. handle.Name = 'Handle'
  681. handle.Locked = true
  682. handle.CanCollide = true
  683. handle.Transparency = 0
  684. handle.BrickColor = BrickColor.new'Medium stone grey'
  685. handle.Size = Vector3.new(2, 0.800000012, 2)
  686. mesh = Instance.new('SpecialMesh', handle)
  687. mesh.MeshId = 'http://www.roblox.com/asset/?id=1594167'
  688. mesh.Scale = Vector3.new(1, 1, 1)
  689. mesh.VertexColor = Vector3.new(1, 1, 1)
  690. mesh.TextureId = 'http://www.roblox.com/asset/?id=1594166'
  691. att = Instance.new('Attachment', handle)
  692. att.Name = 'HatAt'
  693. att.Position = Vector3.new(8.65838956e-09, 0.400000095, -0.000272244215)
  694. att.Axis = Vector3.new(1, -7.87137555e-09, 0)
  695. att.SecondaryAxis = Vector3.new(7.87137555e-09, 1, 4.1444221e-16)
  696. hat.Parent = game:GetService'Players'.LocalPlayer.Character
Add Comment
Please, Sign In to add comment