Advertisement
MasonWall19

Untitled

Jun 13th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.75 KB | None | 0 0
  1. --[[
  2.  
  3. Script shared by eletronix ]]
  4.  
  5.  
  6.  
  7. local player = game:GetService("Players").LocalPlayer
  8.  
  9.  
  10.  
  11. local bin = Instance.new("HopperBin", player.Backpack)
  12.  
  13.  
  14.  
  15. bin.Name = "Striker unit"
  16.  
  17. local camera = game:GetService("Workspace").CurrentCamera
  18.  
  19. local character = player.Character
  20.  
  21.  
  22.  
  23. local torso = character:FindFirstChild("Torso")
  24.  
  25. local humanoid = character:FindFirstChild("Humanoid")
  26.  
  27. local neck = torso:FindFirstChild("Neck")
  28.  
  29.  
  30.  
  31. local rightLeg = character:FindFirstChild("Right Leg")
  32.  
  33. local leftLeg = character:FindFirstChild("Left Leg")
  34.  
  35.  
  36.  
  37. local rightHip = torso:FindFirstChild("Right Hip")
  38.  
  39. local leftHip = torso:FindFirstChild("Left Hip")
  40.  
  41.  
  42.  
  43. local neckAngle = neck.C1
  44.  
  45. local rightHipAngle = rightHip.C1
  46.  
  47. local leftHipAngle = leftHip.C1
  48.  
  49.  
  50.  
  51. local leftWeld = Instance.new("Weld")
  52.  
  53. local rightWeld = Instance.new("Weld")
  54.  
  55.  
  56.  
  57. local velocity = Instance.new("BodyVelocity")
  58.  
  59. local gyro = Instance.new("BodyGyro")
  60.  
  61. local pos = Instance.new("BodyPosition")
  62.  
  63.  
  64.  
  65. local parts = {"StrikerOne", "StrikerTwo", "JointOne", "JointTwo", "PropellerOne", "PropellerTwo"}
  66.  
  67. local welds = {"SWelderOne", "SWelderTwo", "JWelderOne", "JWelderTwo", "PWelderOne", "PWelderTwo"}
  68.  
  69.  
  70.  
  71. local strikerColor = "Really black"
  72.  
  73. local propellerColor = "White"
  74.  
  75. local jointColor = "Bright blue"
  76.  
  77.  
  78.  
  79. local mainModel = Instance.new("Model")
  80.  
  81. local cframePart = Instance.new("Part")
  82.  
  83.  
  84.  
  85. local toolSelected = false
  86.  
  87. local runNext = false
  88.  
  89. local strikerLoaded = false
  90.  
  91. local connected = false
  92.  
  93. local turn = false
  94.  
  95. local forward = false
  96.  
  97. local backward = false
  98.  
  99. local onleft = false
  100.  
  101. local onright = false
  102.  
  103. local onup = false
  104.  
  105. local ondown = false
  106.  
  107.  
  108.  
  109.  
  110.  
  111. local gyroAngleX = 0
  112.  
  113. local desiredGyroAngleX = 0
  114.  
  115. local gyroAngleY = 0
  116.  
  117. local desiredGyroAngleY = 0
  118.  
  119. local gyroAngleZ = 0
  120.  
  121. local desiredGyroAngleZ = 0
  122.  
  123. local angleSetSpeed = 5
  124.  
  125. local rotationIndice = 0
  126.  
  127. local maxRotation = 70
  128.  
  129. local motorSpeed = 0
  130.  
  131. local desiredSpeed = 0
  132.  
  133. local xPartPos = 0
  134.  
  135. local desiredXPartPos = 0
  136.  
  137. local yPartPos = 0
  138.  
  139. local desiredYPartPos = 0
  140.  
  141.  
  142.  
  143. function Striker(delay)
  144.  
  145.  
  146.  
  147. wait(delay)
  148.  
  149.  
  150.  
  151. mainModel.Name = "Striker"
  152.  
  153. mainModel.Archivable = false
  154.  
  155. mainModel.Parent = character
  156.  
  157.  
  158.  
  159. for index, name in pairs(parts) do
  160.  
  161.  
  162.  
  163. getfenv()[name] = Instance.new("Part")
  164.  
  165. getfenv()[name].Name = name
  166.  
  167. getfenv()[name].Anchored = true
  168.  
  169. getfenv()[name].Locked = true
  170.  
  171. getfenv()[name].CanCollide = false
  172.  
  173. getfenv()[name].Transparency = 1
  174.  
  175. getfenv()[name].CFrame = CFrame.new(0, math.huge, 0)
  176.  
  177. getfenv()[name].FormFactor = Enum.FormFactor.Custom
  178.  
  179. getfenv()[name].BottomSurface = Enum.SurfaceType.Smooth
  180.  
  181. getfenv()[name].TopSurface = Enum.SurfaceType.Smooth
  182.  
  183. if index <= 2 then
  184.  
  185. getfenv()[name].BrickColor = BrickColor.new(strikerColor)
  186.  
  187. getfenv()[name].Size = Vector3.new(1.1, 1.5, 1.1)
  188.  
  189. elseif index == 3 or index == 4 then
  190.  
  191. getfenv()[name].BrickColor = BrickColor.new(jointColor)
  192.  
  193. getfenv()[name].Size = Vector3.new(0.25, 0.25, 0.25)
  194.  
  195.  
  196.  
  197. elseif index >= 5 then
  198.  
  199. getfenv()[name].BrickColor = BrickColor.new(propellerColor)
  200.  
  201. getfenv()[name].Size = Vector3.new(1.55, 0.2, 0.2)
  202.  
  203. end
  204.  
  205. getfenv()[name].Parent = mainModel
  206.  
  207. coroutine.resume(coroutine.create(function()
  208.  
  209. for i = getfenv()[name].Transparency, 0, -0.1 do
  210.  
  211. if toolSelected then wait() getfenv()[name].Transparency = i end
  212.  
  213. end
  214.  
  215. end))
  216.  
  217. end
  218.  
  219. for index, name in pairs(welds) do
  220.  
  221. getfenv()[name] = Instance.new("Weld")
  222.  
  223. getfenv()[name].Parent = mainModel
  224.  
  225. getfenv()[name].Name = name
  226.  
  227. if index == 1 then
  228.  
  229. getfenv()[name].Part0 = leftLeg
  230.  
  231. StrikerOne.Anchored = false
  232.  
  233. getfenv()[name].Part1 = StrikerOne
  234.  
  235. getfenv()[name].C1 = CFrame.new(0, 0.35, 0)
  236.  
  237. elseif index == 2 then
  238.  
  239. getfenv()[name].Part0 = rightLeg
  240.  
  241. StrikerTwo.Anchored = false
  242.  
  243. getfenv()[name].Part1 = StrikerTwo
  244.  
  245. getfenv()[name].C1 = CFrame.new(0, 0.35, 0)
  246.  
  247. elseif index == 3 then
  248.  
  249. getfenv()[name].Part0 = StrikerOne
  250.  
  251. JointOne.Anchored = false
  252.  
  253. getfenv()[name].Part1 = JointOne
  254.  
  255. getfenv()[name].C1 = CFrame.new(0, 0.775, 0)
  256.  
  257. JointOne.CanCollide = true
  258.  
  259. elseif index == 4 then
  260.  
  261. getfenv()[name].Part0 = StrikerTwo
  262.  
  263. JointTwo.Anchored = false
  264.  
  265. getfenv()[name].Part1 = JointTwo
  266.  
  267. getfenv()[name].C1 = CFrame.new(0, 0.775, 0)
  268.  
  269. JointTwo.CanCollide = true
  270.  
  271. elseif index == 5 then
  272.  
  273. getfenv()[name].Part0 = JointOne
  274.  
  275. PropellerOne.Anchored = false
  276.  
  277. getfenv()[name].Part1 = PropellerOne
  278.  
  279. elseif index == 6 then
  280.  
  281. getfenv()[name].Part0 = JointTwo
  282.  
  283. PropellerTwo.Anchored = false
  284.  
  285. getfenv()[name].Part1 = PropellerTwo
  286.  
  287. end
  288.  
  289. end
  290.  
  291. wait(0.1)
  292.  
  293. strikerLoaded = true
  294.  
  295. end
  296.  
  297.  
  298.  
  299. function SetAngles(cfr, x, y, z) print("Settings")
  300.  
  301.  
  302.  
  303. local x2, y2, z2 = cfr.C1:toEulerAnglesXYZ()
  304.  
  305. x = math.rad(x)
  306.  
  307. y = math.rad(y)
  308.  
  309. z = math.rad(z)
  310.  
  311. x2 = math.rad(x2)
  312.  
  313. y2 = math.rad(y2)
  314.  
  315. z2 = math.rad(z2)
  316.  
  317.  
  318.  
  319. coroutine.resume(coroutine.create(function() local v1 local v2
  320.  
  321. if x2 < x then v1, v2 = x2, x else v1, v2 = x, x2 end
  322.  
  323. for i = v1, v2, (v2 - v1) / angleSetSpeed do wait()
  324.  
  325. cfr.C1 = unitCfr * CFrame.fromEulerAnglesXYZ(i/v2, 0, 0)
  326.  
  327. end
  328.  
  329. end))
  330.  
  331. coroutine.resume(coroutine.create(function() local v3 local v4
  332.  
  333. if y2 < y then v3, v4 = y2, y else v3, v4 = y, x2 end
  334.  
  335. for i = v3, v4, (v2 - v1) / angleSetSpeed do wait()
  336.  
  337. cfr.C1 = unitCfr * CFrame.fromEulerAnglesXYZ(0, i/v4, 0)
  338.  
  339. end
  340.  
  341. end))
  342.  
  343. coroutine.resume(coroutine.create(function() local v5 local v6
  344.  
  345. if z2 < z then v5, v6 = z2, z else v5, v6 = z, z2 end
  346.  
  347. for i = v5, v6, (v5 - v6) / angleSetSpeed do wait()
  348.  
  349. cfr.C1 = unitCfr * CFrame.fromEulerAnglesXYZ(0, 0, i/v6)
  350.  
  351. end
  352.  
  353. end))
  354.  
  355. end
  356.  
  357.  
  358.  
  359. function Connection(mouse)
  360.  
  361.  
  362.  
  363. toolSelected = true
  364.  
  365.  
  366.  
  367. coroutine.resume(coroutine.create(function() repeat wait()
  368.  
  369.  
  370.  
  371. if toolSelected then
  372.  
  373. if leftHip ~= nil then
  374.  
  375. leftHip.DesiredAngle = 0
  376.  
  377. leftHip.CurrentAngle = 0
  378.  
  379. end
  380.  
  381. if rightHip ~= nil then
  382.  
  383. rightHip.DesiredAngle = 0
  384.  
  385. rightHip.CurrentAngle = 0
  386.  
  387. end
  388.  
  389. runNext = true
  390.  
  391. else break end
  392.  
  393.  
  394.  
  395. until false return false end))
  396.  
  397. repeat wait() until runNext
  398.  
  399. humanoid.PlatformStand = true
  400.  
  401. torso.Anchored = true wait()
  402.  
  403. torso.Velocity = Vector3.new(0, 0, 0)
  404.  
  405. torso.RotVelocity = Vector3.new(0, 0, 0)
  406.  
  407. leftHipAngle = leftHip.C1
  408.  
  409. rightHipAngle = rightHip.C1
  410.  
  411. pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  412.  
  413. pos.Parent = torso
  414.  
  415. pos.position = torso.CFrame.p
  416.  
  417. torso.Anchored = false
  418.  
  419. coroutine.resume(coroutine.create(Striker),0.2)
  420.  
  421. for i = 1, 20, 1 do wait()
  422.  
  423. if toolSelected then
  424.  
  425. pos.position = pos.position + Vector3.new(0, 0.2, 0)
  426.  
  427. torso.CFrame = torso.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(18), 0)
  428.  
  429. humanoid.PlatformStand = true
  430.  
  431. leftHip.C1 = leftHip.C1 * CFrame.new(0, -0.01, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0.5), -math.rad(0.5), -math.rad(0.5))
  432.  
  433. rightHip.C1 = rightHip.C1 * CFrame.new(0, -0.01, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0.5), math.rad(0.5), math.rad(0.5))
  434.  
  435. end
  436.  
  437. end
  438.  
  439. local x22, y22, z22 = leftHip.C1:toEulerAnglesXYZ()
  440.  
  441. repeat wait() until strikerLoaded
  442.  
  443. gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  444.  
  445. gyro.Parent = torso
  446.  
  447. gyro.P = 1500
  448.  
  449. velocity.Parent = torso
  450.  
  451. velocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  452.  
  453. velocity.P = 125
  454.  
  455. if pos ~= nil then if pos.Parent == torso then pos:remove() end end
  456.  
  457. coroutine.resume(coroutine.create(function()
  458.  
  459. while strikerLoaded do wait(0.03405) if toolSelected and rotationIndice < maxRotation then rotationIndice = rotationIndice + 0.25
  460.  
  461. if desiredSpeed ~= 0 then if desiredSpeed > 0 then motorSpeed = desiredSpeed - (maxRotation - rotationIndice) elseif desiredSpeed < 0 then motorSpeed = desiredSpeed + (maxRotation - rotationIndice) end else motorSpeed = 0 end
  462.  
  463. if desiredXPartPos ~= 0 then if desiredXPartPos > 0 then xPartPos = desiredXPartPos - (maxRotation/2 - rotationIndice/2) elseif desiredXPartPos < 0 then xPartPos = desiredXPartPos + (maxRotation/2 - rotationIndice/2) end else xPartPos = 0 end
  464.  
  465. if desiredYPartPos ~= 0 then if desiredYPartPos > 0 then yPartPos = desiredYPartPos - (maxRotation/2 - rotationIndice/2) elseif desiredYPartPos < 0 then yPartPos = desiredYPartPos + (maxRotation/2 - rotationIndice/2) end else yPartPos = 0 end
  466.  
  467. if desiredGyroAngleX ~= 0 then if desiredGyroAngleX > 0 then gyroAngleX = math.rad(desiredGyroAngleX - (maxRotation - rotationIndice)) elseif desiredGyroAngleX < 0 then gyroAngleX = math.rad(desiredGyroAngleX + (maxRotation - rotationIndice)) end else gyroAngleX = 0 end
  468.  
  469. if desiredGyroAngleY ~= 0 then if desiredGyroAngleY > 0 then gyroAngleY = math.rad(desiredGyroAngleY - (maxRotation - rotationIndice)) elseif desiredGyroAngleY < 0 then gyroAngleY = math.rad(desiredGyroAngleY + (maxRotation - rotationIndice)) end else gyroAngleY = 0 end
  470.  
  471. if desiredGyroAngleZ ~= 0 then if desiredGyroAngleZ > 0 then gyroAngleZ = math.rad(desiredGyroAngleZ - (maxRotation - rotationIndice)) elseif desiredGyroAngleZ < 0 then gyroAngleZ = math.rad(desiredGyroAngleZ + (maxRotation - rotationIndice)) end else gyroAngleZ = 0 end
  472.  
  473. elseif toolSelected and rotationIndice == maxRotation then humanoid.PlatformStand = true motorSpeed = desiredSpeed gyroAngleX = math.rad(desiredGyroAngleX) gyroAngleY = math.rad(desiredGyroAngleY) gyroAngleZ = math.rad(desiredGyroAngleZ) xPartPos = desiredXPartPos yPartPos = desiredYPartPos end
  474.  
  475. if PropellerOne ~= nil and PWelderOne ~= nil then
  476.  
  477. PWelderOne.C1 = PWelderOne.C1 * CFrame.fromEulerAnglesXYZ(0, -math.rad(rotationIndice), 0)
  478.  
  479. end
  480.  
  481. if PropellerTwo ~= nil and PWelderTwo ~= nil then
  482.  
  483. PWelderTwo.C1 = PWelderTwo.C1 * CFrame.fromEulerAnglesXYZ(0, math.rad(rotationIndice), 0)
  484.  
  485. end
  486.  
  487. if cframePart ~= nil then
  488.  
  489.  
  490.  
  491. cframePart.Size = Vector3.new(0.2, 0.2, 0.2)
  492.  
  493. cframePart.CFrame = CFrame.new(torso.CFrame.p, camera.CoordinateFrame.lookVector * 10000000) + Vector3.new(xPartPos, yPartPos, 0)
  494.  
  495. end
  496.  
  497. if velocity ~= nil then if velocity.Parent == torso then velocity.velocity = (cframePart.CFrame - cframePart.CFrame.p) * Vector3.new(xPartPos, yPartPos, -motorSpeed) end end
  498.  
  499. if gyro ~= nil then if gyro.Parent == torso then gyro.cframe = CFrame.new(gyro.cframe.p, camera.CoordinateFrame.lookVector * 10000000) * CFrame.fromEulerAnglesXYZ(gyroAngleX, gyroAngleY, gyroAngleZ) end end
  500.  
  501. end return
  502.  
  503. end)) connected = true stand = true
  504.  
  505. mouse.KeyDown:connect(function(key) key = key:lower()
  506.  
  507. if key == "w" then ForwardDown()
  508.  
  509. elseif key == "s" then BackwardDown()
  510.  
  511. elseif key == "a" then LeftDown()
  512.  
  513. elseif key == "d" then RightDown()
  514.  
  515. elseif key == "e" then UpDown()
  516.  
  517. elseif key == "q" then DownDown()
  518.  
  519. end end)
  520.  
  521. mouse.KeyUp:connect(function(key) key = key:lower()
  522.  
  523. if key == "w" then ForwardUp() if backward then BackwardDown() end
  524.  
  525. elseif key == "s" then BackwardUp() if forward then ForwardDown() end
  526.  
  527. elseif key == "a" then LeftUp() if onright then RightDown() end
  528.  
  529. elseif key == "d" then RightUp() if onleft then LeftDown() end
  530.  
  531. elseif key == "e" then UpUp() if ondown then DownDown() end
  532.  
  533. elseif key == "q" then DownUp() if onup then UpDown() end
  534.  
  535. end end)
  536.  
  537.  
  538.  
  539. end
  540.  
  541.  
  542.  
  543. function Disconnection()
  544.  
  545.  
  546.  
  547. toolSelected = false wait()
  548.  
  549. for index, name in pairs(parts) do
  550.  
  551. if getfenv()[name] ~= nil then
  552.  
  553. coroutine.resume(coroutine.create(function()
  554.  
  555. for i = getfenv()[name].Transparency, 1, 0.1 do wait()
  556.  
  557. getfenv()[name].Transparency = i
  558.  
  559. end
  560.  
  561. end))
  562.  
  563. end
  564.  
  565. end
  566.  
  567. pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  568.  
  569. pos.Parent = torso
  570.  
  571. pos.position = torso.CFrame.p
  572.  
  573. coroutine.resume(coroutine.create(Striker),0.2)
  574.  
  575. for i = 1, 10, 1 do wait()
  576.  
  577. pos.position = pos.position - Vector3.new(0, 0.15, 0)
  578.  
  579. humanoid.PlatformStand = true
  580.  
  581.  
  582.  
  583. leftHip.C1 = leftHip.C1 * CFrame.new(0, 0.02, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-1), -math.rad(-1), -math.rad(-1))
  584.  
  585. rightHip.C1 = rightHip.C1 * CFrame.new(0, 0.02, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-1), math.rad(-1), math.rad(-1))
  586.  
  587. end wait()
  588.  
  589. humanoid.PlatformStand = false
  590.  
  591. if pos ~= nil then if pos.Parent == torso then pos:remove() end end
  592.  
  593. if gyro ~= nil then if gyro.Parent == torso then gyro:remove() end end
  594.  
  595. if velocity ~= nil then if velocity.Parent == torso then velocity:remove() end end
  596.  
  597. if mainModel ~= nil then mainModel:remove() end
  598.  
  599. strikerLoaded = false
  600.  
  601. rotationIndice = 0
  602.  
  603. motorSpeed = 0
  604.  
  605. desiredSpeed = 0
  606.  
  607. ForwardUp()
  608.  
  609. BackwardUp()
  610.  
  611. LeftUp()
  612.  
  613. RightUp()
  614.  
  615. forward = false
  616.  
  617. backward = false
  618.  
  619. onleft = false
  620.  
  621. onright = false
  622.  
  623. onup = false
  624.  
  625. ondown = false
  626.  
  627. leftHip.C1 = leftHipAngle
  628.  
  629. rightHip.C1 = rightHipAngle
  630.  
  631. connected = false
  632.  
  633.  
  634.  
  635. end
  636.  
  637.  
  638.  
  639. function ForwardDown() forward = true
  640.  
  641.  
  642.  
  643. desiredGyroAngleX = -maxRotation
  644.  
  645. desiredSpeed = maxRotation
  646.  
  647.  
  648.  
  649. end
  650.  
  651.  
  652.  
  653. function BackwardDown() backward = true
  654.  
  655.  
  656.  
  657. desiredGyroAngleX = maxRotation
  658.  
  659. desiredSpeed = -maxRotation
  660.  
  661.  
  662.  
  663. end
  664.  
  665.  
  666.  
  667. function ForwardUp() forward = false
  668.  
  669.  
  670.  
  671. desiredGyroAngleX = 0
  672.  
  673. desiredSpeed = 0
  674.  
  675.  
  676.  
  677. end
  678.  
  679.  
  680.  
  681. function BackwardUp() backward = false
  682.  
  683.  
  684.  
  685. desiredGyroAngleX = 0
  686.  
  687. desiredSpeed = 0
  688.  
  689.  
  690.  
  691. end
  692.  
  693.  
  694.  
  695. function LeftDown() onleft = true
  696.  
  697.  
  698.  
  699. desiredGyroAngleY = -maxRotation
  700.  
  701. desiredXPartPos = -maxRotation/2
  702.  
  703.  
  704.  
  705. end
  706.  
  707.  
  708.  
  709. function RightDown() onright = true
  710.  
  711.  
  712.  
  713. desiredGyroAngleY = maxRotation
  714.  
  715. desiredXPartPos = maxRotation/2
  716.  
  717.  
  718.  
  719. end
  720.  
  721.  
  722.  
  723. function LeftUp() onleft = false
  724.  
  725.  
  726.  
  727. desiredGyroAngleY = 0
  728.  
  729. desiredXPartPos = 0
  730.  
  731.  
  732.  
  733. end
  734.  
  735.  
  736.  
  737. function RightUp() onright = false
  738.  
  739.  
  740.  
  741. desiredGyroAngleY = 0
  742.  
  743. desiredXPartPos = 0
  744.  
  745.  
  746.  
  747. end
  748.  
  749.  
  750.  
  751. function UpDown() onup = true
  752.  
  753.  
  754.  
  755. desiredYPartPos = maxRotation/2
  756.  
  757.  
  758.  
  759. end
  760.  
  761.  
  762.  
  763. function DownDown() ondown = true
  764.  
  765.  
  766.  
  767. desiredYPartPos = -maxRotation/2
  768.  
  769.  
  770.  
  771. end
  772.  
  773.  
  774.  
  775. function UpUp() onup = false
  776.  
  777.  
  778.  
  779. desiredYPartPos = 0
  780.  
  781.  
  782.  
  783. end
  784.  
  785.  
  786.  
  787. function DownUp() ondown = false
  788.  
  789.  
  790.  
  791. desiredYPartPos = 0
  792.  
  793.  
  794.  
  795. end
  796.  
  797.  
  798.  
  799.  
  800.  
  801. bin.Selected:connect(Connection)
  802.  
  803. bin.Deselected:connect(Disconnection)
  804.  
  805.  
  806.  
  807. --mediafire
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement