Jetdarc

Ogre Rocket

Apr 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.77 KB | None | 0 0
  1. -- Rideket
  2. -- @Acecateer
  3. -- Edited by Jetdarc
  4.  
  5. -- Acecateer Rideket
  6.  
  7. wait(0.5)
  8.  
  9.  
  10. --[[ Missile properties ]]--
  11. local currentSpeed                        = 0
  12. local ejectedSpeed                        = 0
  13. local maxSpeed                                = 350
  14. local increaseTime                        = 0.3
  15. local increaseIncrement                = 50
  16. local decreaseTime                        = 0.2
  17. local decreaseIncrement                = 15
  18. local collisionSpeed                = 100
  19. local doPrints                                = false
  20. local Color                                        = false
  21. local speedGauge                        = true
  22.  
  23. local Player                                = game.Players.LocalPlayer
  24. local Mouse                                        = Player:GetMouse()
  25. Mouse.TargetFilter                        = workspace
  26. local mousePos
  27. repeat wait() until Player.Character:IsDescendantOf(workspace)
  28. local Character                                = Player.Character
  29. repeat wait() until Character:FindFirstChild("Humanoid")
  30. local Humanoid                                = Character.Humanoid
  31. Humanoid:WaitForChild("Animator"):Destroy()
  32.  
  33. -- Services
  34. local InputService                        = game:GetService("UserInputService")
  35. local RunService                        = game:GetService("RunService")
  36.  
  37. -- Set up character variables
  38. local bodyParts                                = {}
  39. local Joints                                = {}
  40.  
  41. local scanCharacter        = function()
  42.         Scan = function(Target)
  43.                 for _, child in pairs(Target:GetChildren()) do
  44.                         if child:IsA("Part") then
  45.                                 bodyParts[child.Name]         = child
  46.                                 if #child:GetChildren() > 0 then
  47.                                         Scan(child)
  48.                                 end
  49.                         elseif child:IsA("Motor6D") then
  50.                                 Joints[child.Name]                = child
  51.                         end
  52.                 end
  53.         end
  54.         Scan(Character)
  55. end
  56. scanCharacter()
  57.  
  58. local fromRootC0, fromRootC1 = Joints["RootJoint"].C0, Joints["RootJoint"].C1
  59. local fromNeck                        = Joints["Neck"].C1
  60. local fromLeftShoulder        = Joints["Left Shoulder"].C1
  61. local fromRightShoulder        = Joints["Right Shoulder"].C1
  62. local fromLeftHip                = Joints["Left Hip"].C1
  63. local fromRightHip                = Joints["Right Hip"].C1
  64.  
  65. local Seat                                = Instance.new("Seat", Character)
  66. Seat.Transparency                = 1
  67. Seat.CanCollide                        = false
  68. Seat.FormFactor                        = Enum.FormFactor.Custom
  69. Seat.Size                                = Vector3.new(1, 0.5, 1)
  70. local seatWeld                        = Instance.new("Weld", Seat)
  71. seatWeld.Part0                        = Seat
  72. seatWeld.Part1                        = bodyParts["Torso"]
  73. seatWeld.C1                                = CFrame.new(0, -0.8, 0) * CFrame.Angles(math.pi/2, 0, 0)
  74.  
  75. local lastSeatChar
  76. local preLeftJoint, preRightJoint
  77. Seat.Changed:connect(function(Property)
  78.         if Property == "Occupant" and Seat.Occupant then
  79.                 lastSeatChar        = Seat.Occupant.Parent
  80.                 local Torso                = lastSeatChar:FindFirstChild("Torso")
  81.                 if Torso then
  82.                         local LeftJoint                = Torso["Left Hip"]
  83.                         local RightJoint        = Torso["Right Hip"]
  84.                         preLeftJoint        = LeftJoint.C1
  85.                         preRightJoint        = RightJoint.C1
  86.                         LeftJoint.C1                = LeftJoint.C1 * CFrame.Angles(math.rad(25), 0, 0)
  87.                         RightJoint.C1                = RightJoint.C1 * CFrame.Angles(math.rad(25), 0, 0)
  88.                 end
  89.         elseif not Seat.Occupant and lastSeatChar then
  90.                 local Torso                = lastSeatChar:FindFirstChild("Torso")
  91.                 if Torso then
  92.                         local LeftJoint                = Torso["Left Hip"]
  93.                         local RightJoint        = Torso["Right Hip"]
  94.                         LeftJoint.C1                = preLeftJoint
  95.                         RightJoint.C1                = preRightJoint
  96.                 end
  97.         end
  98. end)
  99.  
  100. createMissile = function()
  101.         local Ejected                                = false
  102.        
  103.         Humanoid.Jump                                = true; wait(0.3)
  104.        
  105.         local Missile                                = Instance.new("Part", Character)
  106.         Missile.Name                                = "Missile"
  107.         if Color then Missile.BrickColor = Color end
  108.         Missile.FormFactor                        = Enum.FormFactor.Custom
  109.         Missile.Size                                = Vector3.new(1.56, 1.37, 5.65)
  110.        
  111.         local Mesh                                        = Instance.new("SpecialMesh", Missile)
  112.         Mesh.MeshId                                        = "http://www.roblox.com/asset/?id=480273787"
  113.         if not Color then Mesh.TextureId = "http://www.roblox.com/asset/?id=480273792" end
  114.         Mesh.Scale                                        = Vector3.new(20, 20, 20)
  115.        
  116.         local EmitterPart                        = Instance.new("Part", Character)
  117.         EmitterPart.Name                        = "SmokeEmitter"
  118.         EmitterPart.CanCollide                = false
  119.         EmitterPart.Transparency        = 1
  120.         EmitterPart.FormFactor                = Enum.FormFactor.Custom
  121.         EmitterPart.Size                        = Vector3.new(0.2, 0.2, 0.2)
  122.        
  123.         local EmitterWeld                        = Instance.new("Weld", Missile)
  124.         EmitterWeld.Part0                        = Missile
  125.         EmitterWeld.Part1                        = EmitterPart
  126.         EmitterWeld.C0                                = CFrame.Angles(math.pi/2, 0, 0)
  127.         EmitterWeld.C1                                = CFrame.new(0, -Missile.Size.Z/2, 0)
  128.        
  129.         local Smoke                                        = Instance.new("ParticleEmitter", EmitterPart)
  130.         Smoke.Enabled                                = false
  131.         Smoke.Size                                        = NumberSequence.new(10)
  132.         Smoke.Texture                                = "rbxassetid://0"
  133.         Smoke.Lifetime                                = NumberRange.new(0.5, 1)
  134.         Smoke.Rate                                        = 100
  135.         Smoke.Rotation                                = NumberRange.new(-15, 15)
  136.         Smoke.RotSpeed                                = NumberRange.new(50)
  137.         Smoke.Speed                                        = NumberRange.new(5, 10)
  138.         Smoke.VelocitySpread                = 60
  139.        
  140.         Joints["RootJoint"].C0                = fromRootC0 * CFrame.Angles(math.pi/2, 0, 0)
  141.         Joints["RootJoint"].C1                = fromRootC1 * CFrame.new(0, 3, 0)
  142.         local Weld                                        = Instance.new("Weld", bodyParts["Torso"])
  143.         Weld.Part0                                        = bodyParts["Torso"]
  144.         Weld.Part1                                        = Missile
  145.         Weld.C0                                                = CFrame.new(0, 0, -1)
  146.         Weld.C1                                                = CFrame.Angles(-math.pi/2, 0, 0)
  147.        
  148.         -- Set up posture!
  149.         local currentLeftShoulder, currentRightShoulder         = Joints["Left Shoulder"].C1, Joints["Right Shoulder"].C1
  150.         local currentLeftHip, currentRightHip                                = Joints["Left Hip"].C1, Joints["Right Hip"].C1
  151.         local currentNeck                        = Joints["Neck"].C1
  152.         local toNeck                                = fromNeck * CFrame.new(0, 0.25, 0) * CFrame.Angles(math.rad(80), 0, 0)
  153.         local toLeftShoulder                = fromLeftShoulder * CFrame.new(-0.3, 0, 0.5) * CFrame.Angles(math.pi/2, math.rad(120), 0)
  154.         local toRightShoulder                = fromRightShoulder * CFrame.new(0.3, 0, 0.5) * CFrame.Angles(math.pi/2, -math.rad(120), 0)
  155.         local toLeftHip                                = fromLeftHip * CFrame.new(0.5, -0.5, 0) * CFrame.Angles(math.rad(30), math.rad(40), math.rad(20))
  156.         local toRightHip                        = fromRightHip * CFrame.new(-0.5, -0.5, 0) * CFrame.Angles(math.rad(30), -math.rad(40), -math.rad(20))
  157.         spawn(function()
  158.                 for i = 0, 1, 0.1 do
  159.                         Joints["Neck"].C1                        = currentNeck:lerp(toNeck, i)
  160.                         Joints["Left Shoulder"].C1         = currentLeftShoulder:lerp(toLeftShoulder, i)
  161.                         Joints["Right Shoulder"].C1        = currentRightShoulder:lerp(toRightShoulder, i)
  162.                         Joints["Left Hip"].C1                = currentLeftHip:lerp(toLeftHip, i)
  163.                         Joints["Right Hip"].C1                = currentRightHip:lerp(toRightHip, i)
  164.                         RunService.RenderStepped:wait()
  165.                 end
  166.         end)
  167.        
  168.         local EjectAnimation = function()
  169.                 local currentLeftShoulder, currentRightShoulder         = Joints["Left Shoulder"].C1, Joints["Right Shoulder"].C1
  170.                 local currentLeftHip, currentRightHip                                = Joints["Left Hip"].C1, Joints["Right Hip"].C1
  171.                 local currentRootC0, currentRootC1                                        = Joints["RootJoint"].C0, Joints["RootJoint"].C1
  172.                 local currentNeck                = Joints["Neck"].C1
  173.                 local toRootC0, toRootC1                                                        = fromRootC0, fromRootC1
  174.                 local toLeftShoulder        = fromLeftShoulder * CFrame.new(0, 0.5, 0.5) * CFrame.Angles(math.rad(120), math.rad(30), 0)
  175.                 local toRightShoulder        = fromRightShoulder * CFrame.new(0, 0.5, 0.5) * CFrame.Angles(math.rad(120), -math.rad(30), 0)
  176.                 local toLeftHip                        = fromLeftHip * CFrame.new(0, -0.3, -0.1) * CFrame.Angles(math.rad(20), 0, 0)
  177.                 local toRightHip                = fromRightHip * CFrame.new(0, -0.3, -0.1) * CFrame.Angles(math.rad(20), 0, 0)
  178.                 for i = 0, 1, 0.1 do
  179.                         Joints["Neck"].C1                                = currentNeck:lerp(fromNeck, i)
  180.                         Joints["RootJoint"].C0                        = currentRootC0:lerp(toRootC0, i)
  181.                         Joints["RootJoint"].C1                        = currentRootC1:lerp(toRootC1, i)
  182.                         Joints["Left Shoulder"].C1                 = currentLeftShoulder:lerp(toLeftShoulder, i)
  183.                         Joints["Right Shoulder"].C1                = currentRightShoulder:lerp(toRightShoulder, i)
  184.                         Joints["Left Hip"].C1                        = currentLeftHip:lerp(toLeftHip, i)
  185.                         Joints["Right Hip"].C1                        = currentRightHip:lerp(toRightHip, i)
  186.                         RunService.RenderStepped:wait()
  187.                 end
  188.         end
  189.        
  190.         -- Set up HUD
  191.         local HUD                                        = Instance.new("ScreenGui", Player.PlayerGui)
  192.         HUD.Name                                        = "HUD"
  193.         local ActivateFrame                        = Instance.new("Frame", HUD)
  194.         ActivateFrame.Name                        = "ActivateFrame"
  195.         ActivateFrame.Position                = UDim2.new(1, -150, 1, -50)
  196.         ActivateFrame.Size                        = UDim2.new(0, 150, 0, 50)
  197.         ActivateFrame.Style                        = "RobloxRound"
  198.         local Button                                = Instance.new("TextButton", ActivateFrame)
  199.         Button.Name                                        = "Button"
  200.         Button.Position                                = UDim2.new(0, -8, 0, -8)
  201.         Button.Size                                        = UDim2.new(1, 16, 1, 16)
  202.         Button.Style                                = "RobloxRoundDropdownButton"
  203.         Button.Text                                        = ""
  204.         local buttonText                        = Instance.new("TextLabel", Button)
  205.         buttonText.ZIndex                        = 2
  206.         buttonText.Name                                = "Text"
  207.         buttonText.BackgroundTransparency = 1
  208.         buttonText.Position                        = UDim2.new(0, -5, 0, -5)
  209.         buttonText.Size                                = UDim2.new(1, 10, 1, 10)
  210.         buttonText.Font                                = Enum.Font.SourceSansBold
  211.         buttonText.TextScaled                = true
  212.         buttonText.Text                                = "Activate"
  213.         buttonText.TextColor3                = Color3.new()
  214.         buttonText.TextTransparency = 0.2
  215.         local Shadow                                = buttonText:Clone()
  216.         Shadow.Parent                                = Button
  217.         Shadow.Name                                        = "Shadow"
  218.         Shadow.Position                                = UDim2.new(0, -3, 0, -3)
  219.         Shadow.ZIndex                                = 1
  220.         Shadow.TextColor3                        = Color3.new(116/255, 116/255, 116/255)
  221.        
  222.         if speedGauge then
  223.                 local speedFrame                 = ActivateFrame:Clone()
  224.                 speedFrame.Position                = UDim2.new(1, -305, 1, -50)
  225.                 local speedButton                = speedFrame:WaitForChild("Button")
  226.                 speedButton.Active                = false
  227.                 speedButton.AutoButtonColor = false
  228.                 speedButtonText                        = speedButton:WaitForChild("Text")
  229.                 speedButtonText.Text        = "0 Studs/s"
  230.                 speedShadow                                = speedButton:WaitForChild("Shadow")
  231.                 speedShadow.Text                = "0 Studs/s"
  232.                 speedFrame.Parent                = HUD
  233.         end
  234.        
  235.         local Activated                                = true
  236.         Button.Style                                = "RobloxRoundButton"
  237.         buttonText.Text                                = "Un-Activate"
  238.         Shadow.Text                                        = "Un-Activate"
  239.        
  240.         Button.MouseButton1Click:connect(function()
  241.                 if not Activated then
  242.                         Activated                        = true
  243.                         Button.Style                = "RobloxRoundButton"
  244.                         buttonText.Text                = "Un-Activate"
  245.                         Shadow.Text                        = "Un-Activate"
  246.                 else
  247.                         Activated                        = false
  248.                         Button.Style                = "RobloxRoundDropdownButton"
  249.                         buttonText.Text                = "Activate"
  250.                         Shadow.Text                        = "Activate"
  251.                 end
  252.         end)
  253.        
  254.         -- Fly away stanley, be free!
  255.         local bodyGyro                                = Instance.new("BodyGyro", Missile)
  256.         bodyGyro.maxTorque                        = Vector3.new(400000, 400000, 400000)
  257.         bodyGyro.P                                        = 6000
  258.         bodyGyro.cframe                                = Missile.CFrame
  259.        
  260.         local bodyPos                                = Instance.new("BodyPosition", Missile)
  261.         bodyPos.maxForce                        = Vector3.new(100000, 100000, 100000)
  262.         bodyPos.P                                        = 1000
  263.         bodyPos.position                        = bodyParts["Torso"].Position
  264.        
  265.         local Sound                                        = Instance.new("Sound", Missile)
  266.         Sound.SoundId                                = "rbxassetid://619804451"
  267.         Sound.Looped                                = true
  268.         local Sound2                                        = Instance.new("Sound", Missile)
  269.         Sound2.SoundId                                = "rbxassetid://619804451"
  270.         Sound2.Looped                                = true
  271.         local Sound3                                        = Instance.new("Sound", Missile)
  272.         Sound3.SoundId                                = "rbxassetid://619804451"
  273.         Sound3.Looped                                = true
  274.        
  275.        
  276.         local lastTick                                = tick()
  277.         local Connection1 = InputService.InputBegan:connect(function(Input)
  278.                 if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
  279.                         Sound:Play(); Smoke.Enabled = true
  280.                         RunService:UnbindFromRenderStep("Stopping")
  281.                         RunService:BindToRenderStep("Flying", 1, function()
  282.                                 local currentTick        = tick()
  283.                                 if currentTick - lastTick >= increaseTime and currentSpeed < maxSpeed then
  284.                                         currentSpeed         = currentSpeed + increaseIncrement
  285.                                         if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
  286.                                         if doPrints then print("Increased speed!", "Current speed: "..currentSpeed) end
  287.                                         if speedGauge then
  288.                                                 speedButtonText.Text         = currentSpeed .. " Studs/s"
  289.                                                 speedShadow.Text                = currentSpeed .. " Studs/s"
  290.                                         end
  291.                                         lastTick                = currentTick
  292.                                 end
  293.                                 mousePos                        = Mouse.Hit.p
  294.                                 bodyGyro.cframe                = CFrame.new(Missile.Position, mousePos)
  295.                                 bodyPos.position        = Missile.Position + (mousePos - Missile.Position).unit * currentSpeed
  296.                         end)
  297.                 end
  298.         end)
  299.        
  300.         local Connection2 = InputService.InputEnded:connect(function(Input)
  301.                 if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
  302.                         Sound:Stop(); Smoke.Enabled = false
  303.                         RunService:UnbindFromRenderStep("Flying")
  304.                         RunService:BindToRenderStep("Stopping", 1, function()
  305.                                 local currentTick        = tick()
  306.                                 if currentTick - lastTick >= decreaseTime and currentSpeed > 0 then
  307.                                         currentSpeed         = currentSpeed - decreaseIncrement
  308.                                         if currentSpeed < 0 then currentSpeed = 0 end
  309.                                         if doPrints then print("Decreased speed!", "Current speed: "..currentSpeed) end
  310.                                         if speedGauge then
  311.                                                 speedButtonText.Text         = currentSpeed .. " Studs/s"
  312.                                                 speedShadow.Text                = currentSpeed .. " Studs/s"
  313.                                         end
  314.                                         lastTick                = currentTick
  315.                                 end
  316.                                 mousePos                        = Mouse.Hit.p
  317.                                 bodyGyro.cframe                = CFrame.new(Missile.Position, mousePos)
  318.                                 bodyPos.position        = Missile.Position + (mousePos - Missile.Position).unit * currentSpeed
  319.                         end)
  320.                 end
  321.         end)
  322.        
  323.         local killConnections = function(Destroy)
  324.                 RunService:UnbindFromRenderStep("Flying")
  325.                 RunService:UnbindFromRenderStep("Stopping")
  326.                 if Connection1 and Connection2 then Connection1:disconnect(); Connection2:disconnect() end
  327.                 if Destroy then Missile:Destroy(); EmitterPart:Destroy() end
  328.         end
  329.        
  330.         local Explode = function(Missile, isEjected)
  331.                 local Explosion                = Instance.new("Explosion")
  332.                 Explosion.BlastRadius = 50
  333.                 Explosion.DestroyJointRadiusPercent = 20
  334.                 Explosion.Position        = Missile.Position
  335.                 Explosion.Parent        = workspace
  336.                
  337.                 local boomPart                = Instance.new("Part", workspace)
  338.                 boomPart.Name                = "Boom"
  339.                 boomPart.Transparency = 1
  340.                 boomPart.Anchored        = true
  341.                 boomPart.CanCollide        = false
  342.                 boomPart.FormFactor        = Enum.FormFactor.Custom
  343.                 boomPart.Size                = Vector3.new(0.2, 0.2, 0.2)
  344.                 boomPart.Position        = Missile.Position
  345.                 local Boom                        = Instance.new("Sound", boomPart)
  346.                 Boom.SoundId                = "rbxassetid://1608455246"
  347.                 Boom:Play()
  348.                 game:GetService("Debris"):AddItem(boomPart, 1)
  349.                 local Boom2                        = Instance.new("Sound", boomPart)
  350.                 Boom2.SoundId                = "rbxassetid://1608455246"
  351.                 Boom2:Play()
  352.                 game:GetService("Debris"):AddItem(boomPart, 1)
  353.                 local Boom3                        = Instance.new("Sound", boomPart)
  354.                 Boom3.SoundId                = "rbxassetid://1608455246"
  355.                 Boom3:Play()
  356.                 game:GetService("Debris"):AddItem(boomPart, 1)
  357.                 local Boom4                        = Instance.new("Sound", boomPart)
  358.                 Boom4.SoundId                = "rbxassetid://1608455246"
  359.                 Boom4:Play()
  360.                 game:GetService("Debris"):AddItem(boomPart, 1)
  361.                 local Boom5                        = Instance.new("Sound", boomPart)
  362.                 Boom5.SoundId                = "rbxassetid://1608455246"
  363.                 Boom5:Play()
  364.                 game:GetService("Debris"):AddItem(boomPart, 1)
  365.  
  366.  
  367.  
  368.  
  369.                
  370.                
  371.                 if isEjected then
  372.                         Missile:Destroy(); EmitterPart:Destroy()
  373.                 else
  374.                         killConnections(true)
  375.                 end
  376.         end
  377.        
  378.         local MissileCon = Missile.Touched:connect(function(Hit)
  379.                 if Activated and not Hit:IsDescendantOf(Character) and Hit.CanCollide and (currentSpeed >= collisionSpeed or (Ejected and ejectedSpeed >= collisionSpeed)) then
  380.                         Explode(Missile)
  381.                 end
  382.         end)
  383.        
  384.         if Humanoid.Health <= 0 then killConnections(true) end
  385.         Humanoid.Died:connect(function() killConnections(true) end)
  386.        
  387.         local Connection3
  388.         Connection3 = InputService.InputBegan:connect(function(Input)
  389.                 if Input.KeyCode == Enum.KeyCode.E and currentSpeed >= 100 then
  390.                         Connection3:disconnect()
  391.                         killConnections()
  392.                         MissileCon:disconnect()
  393.                         Ejected                                        = true
  394.                        
  395.                         local ejectedMissile        = Missile
  396.                         ejectedMissile.Touched:connect(function(Hit)
  397.                                 if not Hit:IsDescendantOf(Character) and Hit.CanCollide then
  398.                                         Explode(ejectedMissile, true)
  399.                                 end
  400.                         end)
  401.                        
  402.                         local ejectedBodyPos        = bodyPos
  403.                         ejectedSpeed                        = currentSpeed
  404.                         currentSpeed                        = 0
  405.                         local toPos                                = mousePos
  406.                         Weld:Destroy()
  407.                         HUD:Destroy()
  408.                         game:GetService("Debris"):AddItem(ejectedMissile, 5); game:GetService("Debris"):AddItem(EmitterPart, 5)
  409.                         local Ejected = RunService.RenderStepped:connect(function()
  410.                                 ejectedBodyPos.position        = ejectedMissile.Position + (toPos - ejectedMissile.Position).unit * ejectedSpeed
  411.                         end)
  412.                         wait(0.1)
  413.                         bodyParts["Torso"].Velocity = Vector3.new(0, 100, 0)
  414.                         EjectAnimation()
  415.                         wait(0.5)
  416.                         createMissile()
  417.                 end
  418.         end)
  419. end
  420. createMissile()
Add Comment
Please, Sign In to add comment