BINO2002

Untitled

Mar 31st, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.96 KB | None | 0 0
  1. --[[
  2. Script shared by eletronix ]]
  3.  
  4. local player = game:GetService("Players").LocalPlayer
  5.  
  6. local bin = Instance.new("HopperBin", player.Backpack)
  7.  
  8. bin.Name = "Striker unit"
  9.  
  10. local camera = game:GetService("Workspace").CurrentCamera
  11. local character = player.Character
  12.  
  13. local torso = character:FindFirstChild("Torso")
  14. local humanoid = character:FindFirstChild("Humanoid")
  15. local neck = torso:FindFirstChild("Neck")
  16.  
  17. local rightLeg = character:FindFirstChild("Right Leg")
  18. local leftLeg = character:FindFirstChild("Left Leg")
  19.  
  20. local rightHip = torso:FindFirstChild("Right Hip")
  21. local leftHip = torso:FindFirstChild("Left Hip")
  22.  
  23. local neckAngle = neck.C1
  24. local rightHipAngle = rightHip.C1
  25. local leftHipAngle = leftHip.C1
  26.  
  27. local leftWeld = Instance.new("Weld")
  28. local rightWeld = Instance.new("Weld")
  29.  
  30. local velocity = Instance.new("BodyVelocity")
  31. local gyro = Instance.new("BodyGyro")
  32. local pos = Instance.new("BodyPosition")
  33.  
  34. local parts = {"StrikerOne", "StrikerTwo", "JointOne", "JointTwo", "PropellerOne", "PropellerTwo"}
  35. local welds = {"SWelderOne", "SWelderTwo", "JWelderOne", "JWelderTwo", "PWelderOne", "PWelderTwo"}
  36.  
  37. local strikerColor = "Really black"
  38. local propellerColor = "White"
  39. local jointColor = "Bright blue"
  40.  
  41. local mainModel = Instance.new("Model")
  42. local cframePart = Instance.new("Part")
  43.  
  44. local toolSelected = false
  45. local runNext = false
  46. local strikerLoaded = false
  47. local connected = false
  48. local turn = false
  49. local forward = false
  50. local backward = false
  51. local onleft = false
  52. local onright = false
  53. local onup = false
  54. local ondown = false
  55.  
  56.  
  57. local gyroAngleX = 0
  58. local desiredGyroAngleX = 0
  59. local gyroAngleY = 0
  60. local desiredGyroAngleY = 0
  61. local gyroAngleZ = 0
  62. local desiredGyroAngleZ = 0
  63. local angleSetSpeed = 5
  64. local rotationIndice = 0
  65. local maxRotation = 70
  66. local motorSpeed = 0
  67. local desiredSpeed = 0
  68. local xPartPos = 0
  69. local desiredXPartPos = 0
  70. local yPartPos = 0
  71. local desiredYPartPos = 0
  72.  
  73. function Striker(delay)
  74.  
  75. wait(delay)
  76.  
  77. mainModel.Name = "Striker"
  78. mainModel.Archivable = false
  79. mainModel.Parent = character
  80.  
  81. for index, name in pairs(parts) do
  82.  
  83. getfenv()[name] = Instance.new("Part")
  84. getfenv()[name].Name = name
  85. getfenv()[name].Anchored = true
  86. getfenv()[name].Locked = true
  87. getfenv()[name].CanCollide = false
  88. getfenv()[name].Transparency = 1
  89. getfenv()[name].CFrame = CFrame.new(0, math.huge, 0)
  90. getfenv()[name].FormFactor = Enum.FormFactor.Custom
  91. getfenv()[name].BottomSurface = Enum.SurfaceType.Smooth
  92. getfenv()[name].TopSurface = Enum.SurfaceType.Smooth
  93.  
  94. if index <= 2 then
  95.  
  96. getfenv()[name].BrickColor = BrickColor.new(strikerColor)
  97. getfenv()[name].Size = Vector3.new(1.1, 1.5, 1.1)
  98.  
  99. elseif index == 3 or index == 4 then
  100.  
  101. getfenv()[name].BrickColor = BrickColor.new(jointColor)
  102. getfenv()[name].Size = Vector3.new(0.25, 0.25, 0.25)
  103.  
  104. elseif index >= 5 then
  105.  
  106. getfenv()[name].BrickColor = BrickColor.new(propellerColor)
  107. getfenv()[name].Size = Vector3.new(1.55, 0.2, 0.2)
  108.  
  109. end
  110.  
  111. getfenv()[name].Parent = mainModel
  112.  
  113. coroutine.resume(coroutine.create(function()
  114.  
  115. for i = getfenv()[name].Transparency, 0, -0.1 do
  116.  
  117. if toolSelected then wait() getfenv()[name].Transparency = i end
  118.  
  119. end
  120.  
  121. end))
  122.  
  123. end
  124.  
  125. for index, name in pairs(welds) do
  126.  
  127. getfenv()[name] = Instance.new("Weld")
  128. getfenv()[name].Parent = mainModel
  129. getfenv()[name].Name = name
  130.  
  131. if index == 1 then
  132.  
  133. getfenv()[name].Part0 = leftLeg
  134. StrikerOne.Anchored = false
  135. getfenv()[name].Part1 = StrikerOne
  136. getfenv()[name].C1 = CFrame.new(0, 0.35, 0)
  137.  
  138. elseif index == 2 then
  139.  
  140. getfenv()[name].Part0 = rightLeg
  141. StrikerTwo.Anchored = false
  142. getfenv()[name].Part1 = StrikerTwo
  143. getfenv()[name].C1 = CFrame.new(0, 0.35, 0)
  144.  
  145. elseif index == 3 then
  146.  
  147. getfenv()[name].Part0 = StrikerOne
  148. JointOne.Anchored = false
  149. getfenv()[name].Part1 = JointOne
  150. getfenv()[name].C1 = CFrame.new(0, 0.775, 0)
  151. JointOne.CanCollide = true
  152.  
  153. elseif index == 4 then
  154.  
  155. getfenv()[name].Part0 = StrikerTwo
  156. JointTwo.Anchored = false
  157. getfenv()[name].Part1 = JointTwo
  158. getfenv()[name].C1 = CFrame.new(0, 0.775, 0)
  159. JointTwo.CanCollide = true
  160.  
  161. elseif index == 5 then
  162.  
  163. getfenv()[name].Part0 = JointOne
  164. PropellerOne.Anchored = false
  165. getfenv()[name].Part1 = PropellerOne
  166.  
  167. elseif index == 6 then
  168.  
  169. getfenv()[name].Part0 = JointTwo
  170. PropellerTwo.Anchored = false
  171. getfenv()[name].Part1 = PropellerTwo
  172.  
  173. end
  174.  
  175. end
  176.  
  177. wait(0.1)
  178.  
  179. strikerLoaded = true
  180.  
  181. end
  182.  
  183. function SetAngles(cfr, x, y, z) print("Settings")
  184.  
  185. local x2, y2, z2 = cfr.C1:toEulerAnglesXYZ()
  186.  
  187. x = math.rad(x)
  188. y = math.rad(y)
  189. z = math.rad(z)
  190.  
  191. x2 = math.rad(x2)
  192. y2 = math.rad(y2)
  193. z2 = math.rad(z2)
  194.  
  195. coroutine.resume(coroutine.create(function() local v1 local v2
  196.  
  197. if x2 < x then v1, v2 = x2, x else v1, v2 = x, x2 end
  198.  
  199. for i = v1, v2, (v2 - v1) / angleSetSpeed do wait()
  200.  
  201. cfr.C1 = unitCfr * CFrame.fromEulerAnglesXYZ(i/v2, 0, 0)
  202.  
  203. end
  204.  
  205. end))
  206.  
  207. coroutine.resume(coroutine.create(function() local v3 local v4
  208.  
  209. if y2 < y then v3, v4 = y2, y else v3, v4 = y, x2 end
  210.  
  211. for i = v3, v4, (v2 - v1) / angleSetSpeed do wait()
  212.  
  213. cfr.C1 = unitCfr * CFrame.fromEulerAnglesXYZ(0, i/v4, 0)
  214.  
  215. end
  216.  
  217. end))
  218.  
  219. coroutine.resume(coroutine.create(function() local v5 local v6
  220.  
  221. if z2 < z then v5, v6 = z2, z else v5, v6 = z, z2 end
  222.  
  223. for i = v5, v6, (v5 - v6) / angleSetSpeed do wait()
  224.  
  225. cfr.C1 = unitCfr * CFrame.fromEulerAnglesXYZ(0, 0, i/v6)
  226.  
  227. end
  228.  
  229. end))
  230.  
  231. end
  232.  
  233. function Connection(mouse)
  234.  
  235. toolSelected = true
  236.  
  237. coroutine.resume(coroutine.create(function() repeat wait()
  238.  
  239. if toolSelected then
  240.  
  241. if leftHip ~= nil then
  242.  
  243. leftHip.DesiredAngle = 0
  244. leftHip.CurrentAngle = 0
  245.  
  246. end
  247.  
  248. if rightHip ~= nil then
  249.  
  250. rightHip.DesiredAngle = 0
  251. rightHip.CurrentAngle = 0
  252.  
  253. end
  254.  
  255. runNext = true
  256.  
  257. else break end
  258.  
  259. until false return false end))
  260.  
  261. repeat wait() until runNext
  262.  
  263. humanoid.PlatformStand = true
  264.  
  265. torso.Anchored = true wait()
  266. torso.Velocity = Vector3.new(0, 0, 0)
  267. torso.RotVelocity = Vector3.new(0, 0, 0)
  268.  
  269. leftHipAngle = leftHip.C1
  270. rightHipAngle = rightHip.C1
  271.  
  272. pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  273. pos.Parent = torso
  274. pos.position = torso.CFrame.p
  275.  
  276. torso.Anchored = false
  277.  
  278. coroutine.resume(coroutine.create(Striker),0.2)
  279.  
  280. for i = 1, 20, 1 do wait()
  281.  
  282. if toolSelected then
  283.  
  284. pos.position = pos.position + Vector3.new(0, 0.2, 0)
  285. torso.CFrame = torso.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(18), 0)
  286. humanoid.PlatformStand = true
  287.  
  288. leftHip.C1 = leftHip.C1 * CFrame.new(0, -0.01, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0.5), -math.rad(0.5), -math.rad(0.5))
  289. rightHip.C1 = rightHip.C1 * CFrame.new(0, -0.01, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0.5), math.rad(0.5), math.rad(0.5))
  290.  
  291. end
  292.  
  293. end
  294.  
  295. local x22, y22, z22 = leftHip.C1:toEulerAnglesXYZ()
  296.  
  297. repeat wait() until strikerLoaded
  298.  
  299. gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  300. gyro.Parent = torso
  301. gyro.P = 1500
  302.  
  303. velocity.Parent = torso
  304. velocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  305. velocity.P = 125
  306.  
  307. if pos ~= nil then if pos.Parent == torso then pos:remove() end end
  308.  
  309. coroutine.resume(coroutine.create(function()
  310.  
  311. while strikerLoaded do wait(0.03405) if toolSelected and rotationIndice < maxRotation then rotationIndice = rotationIndice + 0.25
  312.  
  313. 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
  314. 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
  315. 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
  316.  
  317. 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
  318. 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
  319. 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
  320.  
  321. 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
  322.  
  323. if PropellerOne ~= nil and PWelderOne ~= nil then
  324.  
  325. PWelderOne.C1 = PWelderOne.C1 * CFrame.fromEulerAnglesXYZ(0, -math.rad(rotationIndice), 0)
  326.  
  327. end
  328.  
  329. if PropellerTwo ~= nil and PWelderTwo ~= nil then
  330.  
  331. PWelderTwo.C1 = PWelderTwo.C1 * CFrame.fromEulerAnglesXYZ(0, math.rad(rotationIndice), 0)
  332.  
  333. end
  334.  
  335. if cframePart ~= nil then
  336.  
  337. cframePart.Size = Vector3.new(0.2, 0.2, 0.2)
  338. cframePart.CFrame = CFrame.new(torso.CFrame.p, camera.CoordinateFrame.lookVector * 10000000) + Vector3.new(xPartPos, yPartPos, 0)
  339.  
  340. end
  341.  
  342. if velocity ~= nil then if velocity.Parent == torso then velocity.velocity = (cframePart.CFrame - cframePart.CFrame.p) * Vector3.new(xPartPos, yPartPos, -motorSpeed) end end
  343. 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
  344.  
  345. end return
  346.  
  347. end)) connected = true stand = true
  348.  
  349. mouse.KeyDown:connect(function(key) key = key:lower()
  350.  
  351. if key == "w" then ForwardDown()
  352. elseif key == "s" then BackwardDown()
  353. elseif key == "a" then LeftDown()
  354. elseif key == "d" then RightDown()
  355. elseif key == "e" then UpDown()
  356. elseif key == "q" then DownDown()
  357.  
  358. end end)
  359.  
  360. mouse.KeyUp:connect(function(key) key = key:lower()
  361.  
  362. if key == "w" then ForwardUp() if backward then BackwardDown() end
  363. elseif key == "s" then BackwardUp() if forward then ForwardDown() end
  364. elseif key == "a" then LeftUp() if onright then RightDown() end
  365. elseif key == "d" then RightUp() if onleft then LeftDown() end
  366. elseif key == "e" then UpUp() if ondown then DownDown() end
  367. elseif key == "q" then DownUp() if onup then UpDown() end
  368.  
  369. end end)
  370.  
  371. end
  372.  
  373. function Disconnection()
  374.  
  375. toolSelected = false wait()
  376.  
  377. for index, name in pairs(parts) do
  378.  
  379. if getfenv()[name] ~= nil then
  380.  
  381. coroutine.resume(coroutine.create(function()
  382.  
  383. for i = getfenv()[name].Transparency, 1, 0.1 do wait()
  384.  
  385. getfenv()[name].Transparency = i
  386.  
  387. end
  388.  
  389. end))
  390.  
  391. end
  392.  
  393. end
  394.  
  395. pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  396. pos.Parent = torso
  397. pos.position = torso.CFrame.p
  398.  
  399. coroutine.resume(coroutine.create(Striker),0.2)
  400.  
  401. for i = 1, 10, 1 do wait()
  402.  
  403. pos.position = pos.position - Vector3.new(0, 0.15, 0)
  404. humanoid.PlatformStand = true
  405.  
  406. leftHip.C1 = leftHip.C1 * CFrame.new(0, 0.02, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-1), -math.rad(-1), -math.rad(-1))
  407. rightHip.C1 = rightHip.C1 * CFrame.new(0, 0.02, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-1), math.rad(-1), math.rad(-1))
  408.  
  409. end wait()
  410.  
  411. humanoid.PlatformStand = false
  412.  
  413. if pos ~= nil then if pos.Parent == torso then pos:remove() end end
  414. if gyro ~= nil then if gyro.Parent == torso then gyro:remove() end end
  415. if velocity ~= nil then if velocity.Parent == torso then velocity:remove() end end
  416. if mainModel ~= nil then mainModel:remove() end
  417.  
  418. strikerLoaded = false
  419. rotationIndice = 0
  420. motorSpeed = 0
  421. desiredSpeed = 0
  422.  
  423. ForwardUp()
  424. BackwardUp()
  425. LeftUp()
  426. RightUp()
  427.  
  428. forward = false
  429. backward = false
  430. onleft = false
  431. onright = false
  432. onup = false
  433. ondown = false
  434.  
  435. leftHip.C1 = leftHipAngle
  436. rightHip.C1 = rightHipAngle
  437.  
  438. connected = false
  439.  
  440. end
  441.  
  442. function ForwardDown() forward = true
  443.  
  444. desiredGyroAngleX = -maxRotation
  445. desiredSpeed = maxRotation
  446.  
  447. end
  448.  
  449. function BackwardDown() backward = true
  450.  
  451. desiredGyroAngleX = maxRotation
  452. desiredSpeed = -maxRotation
  453.  
  454. end
  455.  
  456. function ForwardUp() forward = false
  457.  
  458. desiredGyroAngleX = 0
  459. desiredSpeed = 0
  460.  
  461. end
  462.  
  463. function BackwardUp() backward = false
  464.  
  465. desiredGyroAngleX = 0
  466. desiredSpeed = 0
  467.  
  468. end
  469.  
  470. function LeftDown() onleft = true
  471.  
  472. desiredGyroAngleY = -maxRotation
  473. desiredXPartPos = -maxRotation/2
  474.  
  475. end
  476.  
  477. function RightDown() onright = true
  478.  
  479. desiredGyroAngleY = maxRotation
  480. desiredXPartPos = maxRotation/2
  481.  
  482. end
  483.  
  484. function LeftUp() onleft = false
  485.  
  486. desiredGyroAngleY = 0
  487. desiredXPartPos = 0
  488.  
  489. end
  490.  
  491. function RightUp() onright = false
  492.  
  493. desiredGyroAngleY = 0
  494. desiredXPartPos = 0
  495.  
  496. end
  497.  
  498. function UpDown() onup = true
  499.  
  500. desiredYPartPos = maxRotation/2
  501.  
  502. end
  503.  
  504. function DownDown() ondown = true
  505.  
  506. desiredYPartPos = -maxRotation/2
  507.  
  508. end
  509.  
  510. function UpUp() onup = false
  511.  
  512. desiredYPartPos = 0
  513.  
  514. end
  515.  
  516. function DownUp() ondown = false
  517.  
  518. desiredYPartPos = 0
  519.  
  520. end
  521.  
  522.  
  523. bin.Selected:connect(Connection)
  524. bin.Deselected:connect(Disconnection)
  525.  
  526. --mediafire
Add Comment
Please, Sign In to add comment