Advertisement
DeusLoVult

911

Mar 24th, 2017
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.26 KB | None | 0 0
  1. game:GetObjects("rbxassetid://501559112")[1].Parent=game.Workspace
  2. wait(0.5)
  3. game.Workspace.Towers:MoveTo(game.Players.LocalPlayer.Character.Torso.Position + game.Players.LocalPlayer.Character.Torso.CFrame.lookVector* 30)
  4. wait(2)
  5. game:GetObjects("rbxassetid://654695896")[1].Parent=game.Players.LocalPlayer.Backpack
  6. wait(0.5)
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15. Tool = game.Players.LocalPlayer.Backpack:FindFirstChild("MagicCarpet") or game.Players.LocalPlayer.Character:FindFirstChild("MagicCarpet")
  16.  
  17. local stillEquipped = false
  18.  
  19. function onEquippedLocal(mouse)
  20.     stillEquipped = true
  21.     if mouse == nil then
  22.         print("Mouse not found")
  23.         return
  24.     end
  25.     while stillEquipped do
  26.         print("Setting Mouse to go")
  27.         mouse.Icon = "rbxasset://textures\\GunCursor.png"
  28.         while Tool.Enabled and stillEquipped do
  29.             wait(0.01)
  30.         end
  31.         print("Setting Mouse to wait")
  32.         mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  33.         while not Tool.Enabled and stillEquipped do
  34.             wait(0.01)
  35.         end
  36.     end
  37. end
  38.  
  39.  
  40. function onUnequippedLocal()
  41.     stillEquipped = false
  42. end
  43.  
  44. Tool.Equipped:connect(onEquippedLocal)
  45. Tool.Unequipped:connect(onUnequippedLocal)
  46.  
  47.  
  48. local Tool = game.Players.LocalPlayer.Backpack:FindFirstChild("MagicCarpet") or game.Players.LocalPlayer.Character:FindFirstChild("MagicCarpet")
  49. local Carpet = Tool.Handle
  50.  
  51. function waitForChild(parent, instance)
  52.     while parent:FindFirstChild(instance) == nil do
  53.         print("Waiting for" ..  instance)
  54.         wait()
  55.     end
  56. end
  57.  
  58. waitForChild(Tool, "CarpetB1Weld")
  59. waitForChild(Tool, "CarpetB2Weld")
  60. waitForChild(Tool, "CarpetTailWeld")
  61. waitForChild(Carpet, "CarpetB1")
  62. waitForChild(Carpet, "CarpetB2")
  63. waitForChild(Carpet, "CarpetTail")
  64.  
  65. local carpetB1Weld = Tool.CarpetB1Weld
  66. local carpetB2Weld = Tool.CarpetB2Weld
  67. local carpetTailWeld = Tool.CarpetTailWeld
  68.  
  69. local carpetB1 = Carpet.CarpetB1
  70. local carpetB2 = Carpet.CarpetB2
  71. local carpetTail = Carpet.CarpetTail
  72.  
  73.  
  74. local sparkles
  75. local flightSpin
  76. local flightPower
  77. local flightHold
  78.  
  79. local cooldownCo
  80.  
  81. local vCharacter
  82. local myTorso
  83. local myHumanoid
  84.  
  85. local fire
  86.  
  87. local carpetActive
  88.  
  89. local debris = game:GetService("Debris")
  90.  
  91. Tool.Enabled = true
  92.  
  93. local santaSound
  94.  
  95. local giftAssets = {6125503, 6203087, 66897125, 41452698}
  96.  
  97. function tagHumanoid(humanoid, player)
  98.     if humanoid ~= nil then
  99.         creator = Instance.new("ObjectValue")
  100.         creator.Parent = humanoid
  101.         creator.Value = player
  102.         creator.Name = "creator"
  103.         debris:AddItem(creator, 1)
  104.     end
  105. end
  106.  
  107. function cooldown()
  108.     Carpet.Transparency = 1.0
  109.     if carpetTail then
  110.         sparkles = Instance.new("Sparkles")
  111.         sparkles.Parent = carpetTail
  112.     end
  113.     local duration = 40.0
  114.     local sign = -1
  115.     local count = 0
  116.     local initTailC1
  117.     local initB1C1
  118.     local initB2C1
  119.     if carpetTailWeld then
  120.         initTailC1 = carpetTailWeld.C1
  121.     end
  122.     if carpetB1Weld then
  123.         initB1C1 = carpetB1Weld.C1
  124.     end
  125.     if carpetB2Weld then
  126.         initB2C1 = carpetB2Weld.C1
  127.     end
  128.  
  129.     if carpetB1 then
  130.         carpetB1.Mesh.MeshId = "http://www.roblox.com/asset/?id=161268656"
  131.     end
  132.    
  133.     while duration > 0 do
  134.         duration = duration - wait()
  135.         if carpetTailWeld and carpetB1Weld and carpetB2Weld then
  136.             carpetTailWeld.C1 = CFrame.Angles(-sign * math.pi/100, 0, 0) * carpetTailWeld.C1
  137.             carpetB1Weld.C1 = CFrame.Angles(-sign * math.pi/100, 0, 0) * carpetB1Weld.C1
  138.             carpetB2Weld.C1 = CFrame.Angles(sign * math.pi/100, 0, 0) * carpetB2Weld.C1                    
  139.             if count%8 == 0 then
  140.                 sign = sign * -1
  141.             end
  142.             count = count + 1
  143.         end
  144.         wait()
  145.     end
  146.     if carpetTailWeld then
  147.         carpetTailWeld.C1 = initTailC1
  148.     end
  149.     if carpetB1Weld then
  150.         carpetB1Weld.C1 = initB1C1
  151.     end
  152.     if carpetB2Weld then
  153.         carpetB2Weld.C1 = initB2C1
  154.     end    
  155.     if flightSpin then flightSpin:Remove() end
  156.     if flightPower then flightPower:Remove() end
  157.     if flightHold then flightHold:Remove() end
  158.     ratio = myHumanoid.Health/myHumanoid.MaxHealth
  159.     myHumanoid.MaxHealth = 100
  160.     wait(0.1)
  161.     myHumanoid.Health = ratio * 100
  162.     Tool.Enabled = false
  163.     if fire then fire:Remove() end
  164.     if sparkles then sparkles:Remove() end
  165.     carpetUp()
  166.     wait(15.0) 
  167.     Tool.Enabled = true    
  168.     if carpetActive then carpetActive.Value = 0 end
  169.     if carpetB1 then
  170.         carpetB1.Mesh.MeshId = "http://www.roblox.com/asset/?id=161268656"
  171.     end
  172.     Carpet.Transparency = 0.0
  173. end
  174.  
  175. function carpetUp()
  176.     Tool.GripForward = Vector3.new(-0.006, 0, -1)  
  177.     Tool.GripUp = Vector3.new(0.049, 0.999, -0)
  178.     Tool.GripRight = Vector3.new(0.999, -0.049, -0.006)    
  179.     Tool.GripPos =  Vector3.new(1.508, 2.326, -4.143)  
  180. end
  181.  
  182. function carpetMid()   
  183.     Tool.GripForward = Vector3.new(-0.006, 0, -1)  
  184.     Tool.GripUp = Vector3.new(0.049, 0.999, -0)
  185.     Tool.GripRight = Vector3.new(0.999, -0.049, -0.006)    
  186.     Tool.GripPos =  Vector3.new(1.508, 2.326, -4.143)
  187. end
  188.  
  189. function onActivated()
  190.     vCharacter = Tool.Parent
  191.     if vCharacter ~= nil then
  192.         myHumanoid = vCharacter:FindFirstChild("Humanoid")
  193.         if myHumanoid then
  194.             myTorso = vCharacter:FindFirstChild("Torso")
  195.             carpetActive = Tool:FindFirstChild("CarpetActive")         
  196.             if myTorso then
  197.                 if cooldownCo == nil or coroutine.status(cooldownCo) == 'dead' then
  198.                     --Carpet.Transparency = 1.0
  199.                     carpetMid()
  200.                    
  201.                     ratio = myHumanoid.Health/myHumanoid.MaxHealth
  202.                     myHumanoid.MaxHealth = 200
  203.                     wait(0.1)
  204.                     myHumanoid.Health = ratio * 200
  205.                    
  206.                     flightSpin = myTorso:FindFirstChild("FlightSpin")
  207.                     flightPower = myTorso:FindFirstChild("FlightPower")
  208.                     flightHold = myTorso:FindFirstChild("FlightHold")
  209.                     if flightSpin ~= nil or flightPower ~= nil or flightHold ~= nil then debounce = false return end                   
  210.                     if carpetActive then print("Setting Carpet Active") carpetActive.Value = 1 end             
  211.                     flightSpin = Instance.new("BodyGyro")
  212.                     flightPower = Instance.new("BodyVelocity")
  213.  
  214.                     flightHold = Instance.new("BodyPosition")
  215.                     flightHold.Name = "FlightHold"
  216.                     flightHold.P = 100000
  217.                     flightHold.maxForce = Vector3.new(0,0,0)
  218.  
  219.  
  220.                     flightPower.Name = "FlightPower"
  221.                     flightPower.velocity = Vector3.new(0,0,0)
  222.                     flightPower.P = 1000000
  223.                     flightPower.maxForce = Vector3.new(flightPower.P, flightPower.P, flightPower.P)
  224.                     flightPower.P = 10000
  225.  
  226.                     flightSpin.Name = "FlightSpin"
  227.                     flightSpin.P = 1000000
  228.                     flightSpin.maxTorque = Vector3.new(flightSpin.P, flightSpin.P, flightSpin.P)
  229.  
  230.                     flightSpin.cframe = myTorso.CFrame
  231.                     flightSpin.Parent = myTorso
  232.                     flightHold.position = myTorso.Position
  233.                     flightHold.Parent = myTorso
  234.                     flightPower.Parent = myTorso
  235.  
  236.                     myTorso.Velocity = Vector3.new(0,0,0)
  237.                     myTorso.RotVelocity = Vector3.new(0,0,0)   
  238.  
  239.                     myHumanoid.Sit = true
  240.                    
  241.                     cooldownCo = coroutine.create(cooldown)
  242.                     coroutine.resume(cooldownCo)                                   
  243.                 end
  244.             end
  245.         end
  246.     end
  247. end
  248.  
  249. function onEquipped()
  250.     vCharacter = Tool.Parent
  251.     myTorso = vCharacter:FindFirstChild("Torso")
  252.     myHumanoid = vCharacter:FindFirstChild("Humanoid")
  253.     vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
  254.  
  255.     if carpetB1Weld then carpetB1Weld.Parent = Tool end
  256.     if carpetB2Weld then carpetB2Weld.Parent = Tool end
  257.     if carpetTailWeld then carpetTailWeld.Parent = Tool end
  258. end
  259.  
  260. function onUnequipped()    
  261.     if flightPower then flightPower:remove() end
  262.     if flightSpin then flightSpin:remove() end
  263.     if flightHold then flightHold:remove() end
  264.  
  265.     if myHumanoid then
  266.         ratio = myHumanoid.Health/myHumanoid.MaxHealth
  267.         myHumanoid.MaxHealth = 100
  268.         wait(0.1)
  269.         myHumanoid.Health = ratio * 100
  270.     end
  271.     carpetUp()
  272.     if santaSound then santaSound:Stop() end
  273.     if sparkles then sparkles:Remove() end
  274.     Carpet.Transparency = 0.0
  275.     if carpetB1 then
  276.         carpetB1.Mesh.MeshId = "http://www.roblox.com/asset/?id=161268656"
  277.     end
  278. end
  279.  
  280.  
  281. Tool.Activated:connect(onActivated)
  282. Tool.Equipped:connect(onEquipped)
  283. Tool.Unequipped:connect(onUnequipped)
  284.  
  285.  
  286.  
  287.  
  288. local Tool = game.Players.LocalPlayer.Backpack:FindFirstChild("MagicCarpet") or game.Players.LocalPlayer.Character:FindFirstChild("MagicCarpet")
  289.  
  290. local flightPower
  291. local flightSpin
  292. local flightHold
  293.  
  294. local camSpeedZ = 60
  295. local camSpeedX = 40
  296.  
  297. local forwards = false
  298. local back = false
  299. local left = false
  300. local right = false
  301.  
  302. local unEquipped = false
  303.  
  304. local movementHandlerCo
  305.  
  306. local hover = -.1
  307.  
  308. local carpetActive
  309.  
  310. local myTorso
  311. local vCharacter
  312. local myHumanoid
  313.  
  314. function handleMovementFrame()
  315.     local newPush = Vector3.new(0,0,0)
  316.     local forwardVector = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 0, -1))
  317.  
  318.     if forwards and not back then newPush = forwardVector * camSpeedZ end
  319.     if back and not forwards then newPush = newPush + forwardVector * -camSpeedZ end
  320.     if left and not right then newPush = newPush + game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(-1, 0, 0)) * camSpeedX end
  321.     if right and not left then newPush = newPush + game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(1, 0, 0)) * camSpeedX end
  322.  
  323.     flightSpin.cframe = CFrame.new(Vector3.new(0,0,0), forwardVector) -- have torso face forwards
  324.     if newPush.magnitude < 1 then
  325.         flightHold.maxForce = Vector3.new(flightHold.P, flightHold.P, flightHold.P)
  326.         flightPower.maxForce = Vector3.new(0, 0, 0)
  327.         if myTorso then flightHold.position = myTorso.Position end
  328.     else
  329.         flightHold.maxForce = Vector3.new(0, 0, 0)
  330.         flightPower.maxForce = Vector3.new(flightPower.P*100, flightPower.P*100, flightPower.P*100)
  331.     end
  332.         flightPower.velocity = newPush
  333. end
  334.  
  335. function handleMovement()  
  336.     carpetActive = Tool:FindFirstChild("CarpetActive")
  337.     if carpetActive then
  338.         while carpetActive.Value == 1 do
  339.             handleMovementFrame()
  340.             if not unEquipped then if myHumanoid then myHumanoid.Sit = true end end
  341.             wait()
  342.         end
  343.     end
  344. end
  345.  
  346. function keyUpFunc(key)
  347.     if key == nil then return end
  348.     local key = key:lower()
  349.     if key == "w" then
  350.         forwards = false
  351.     elseif key == "a" then
  352.         left = false
  353.     elseif key == "s" then
  354.         back = false
  355.     elseif key == "d" then
  356.         right = false
  357.     end
  358. end
  359.  
  360. function keyDownFunc(key)  
  361.     if key == nil then return end
  362.     local key = key:lower()
  363.     if key == "w" then
  364.         forwards = true
  365.     elseif key == "a" then
  366.         left = true
  367.     elseif key == "s" then
  368.         back = true
  369.     elseif key == "d" then
  370.         right = true
  371.     end
  372. end
  373.  
  374. function carpetActivate()  
  375.     carpetActive = Tool:FindFirstChild("CarpetActive")
  376.     if carpetActive then
  377.         if carpetActive.Value == 0 then return end
  378.     end
  379.     local vCharacter = Tool.Parent
  380.     myTorso = vCharacter:FindFirstChild("Torso")
  381.     if myTorso == nil then return end
  382.    
  383.     flightPower = vCharacter.Torso:FindFirstChild("FlightPower")
  384.     flightSpin = vCharacter.Torso:FindFirstChild("FlightSpin")
  385.     flightHold = vCharacter.Torso:FindFirstChild("FlightHold")
  386.  
  387.     while flightPower == nil or flightSpin == nil or flightHold == nil do      
  388.         Tool.Parent.Torso.ChildAdded:wait()
  389.         flightPower = Tool.Parent.Torso:FindFirstChild("FlightPower")
  390.         flightSpin = Tool.Parent.Torso:FindFirstChild("FlightSpin")
  391.         flightHold = Tool.Parent.Torso:FindFirstChild("FlightHold")
  392.     end    
  393.     print("Handling Movement")
  394.     movementHandlerCo = coroutine.create(handleMovement)   
  395.     coroutine.resume(movementHandlerCo)
  396. end
  397.  
  398. function onEquipped(mouse) 
  399.     print("Equipped")
  400.     if mouse then      
  401.         forwards = false
  402.         back = false
  403.         left = false
  404.         right = false              
  405.         mouse.KeyDown:connect(keyDownFunc)
  406.         mouse.KeyUp:connect(keyUpFunc)             
  407.     end
  408.     vCharacter = Tool.Parent
  409.     myHumanoid = vCharacter:FindFirstChild("Humanoid")
  410.     carpetActive = Tool:FindFirstChild("CarpetActive")
  411.     if carpetActive then print("Connection established") carpetActive.Changed:connect(carpetActivate) end
  412. end
  413.  
  414. function onUnequipped()
  415.     unEquipped = true
  416. end
  417.  
  418. Tool.Equipped:connect(onEquipped)
  419. Tool.Unequipped:connect(onUnequipped)
  420.  
  421. print("Done")
  422.  
  423. wait(0.5)
  424.  
  425. Instance.new("ForceField" ,game.Players.LocalPlayer.Character)
  426.  
  427. kek = game.Players.LocalPlayer.Name
  428.  
  429. local children = game.Workspace.Towers.Tower2:GetChildren()
  430. for _, child in pairs(children) do
  431.     for _, child in pairs(child:GetChildren()) do
  432.         table.insert(children, child)
  433.     end
  434.  
  435.     if child:IsA("BasePart") then
  436.  
  437.  
  438. local function handleTouch(otherPart)
  439.     local character = otherPart.Parent
  440.     local humanoid = character:FindFirstChild("CarpetB1") or character:FindFirstChild("CarpetB2") or character:FindFirstChild("CarpetTail") or character:FindFirstChild("Handle")
  441.     if humanoid then
  442.         child.Anchored = false
  443.         fire2 = Instance.new("Fire")
  444.         fire2.Parent = child
  445.         explo1 = Instance.new("Explosion")
  446.         explo1.Parent = child
  447.         explo1.BlastPressure = 10
  448.         explo1.Position = child.Position
  449.     end
  450. end
  451.  
  452. child.Touched:connect(handleTouch)
  453. end
  454. end
  455.  
  456. local children = game.Workspace.Towers.Tower1:GetChildren()
  457. for _, child in pairs(children) do
  458.     for _, child in pairs(child:GetChildren()) do
  459.         table.insert(children, child)
  460.     end
  461.  
  462.     if child:IsA("BasePart") then
  463.  
  464.  
  465. local function handleTouch(otherPart)
  466.     local character = otherPart.Parent
  467.     local humanoid = character:FindFirstChild("CarpetB1") or character:FindFirstChild("CarpetB2") or character:FindFirstChild("CarpetTail") or character:FindFirstChild("Handle")
  468.     if humanoid then
  469.         child.Anchored = false
  470.         fire1 = Instance.new("Fire")
  471.         fire1.Parent = child
  472.         explo2 = Instance.new("Explosion")
  473.         explo2.Parent = child
  474.         explo2.BlastPressure = 10
  475.         explo2.Position = child.Position
  476.     end
  477. end
  478.  
  479. child.Touched:connect(handleTouch)
  480. end
  481. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement