Advertisement
lafur

Untitled

Jan 18th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. local seat = script.Parent
  2. local bot = seat.Parent
  3. local han = bot.Handle
  4. local blade = bot.Blade
  5. local tor = bot.Tor
  6. local bg = tor.BodyGyro
  7. local bv = tor.BodyVelocity
  8. local ra = bot.RArm
  9. local la = bot.LArm
  10. local rl = bot.RLeg
  11. local ll = bot.LLeg
  12. local motor = "Motor6D"
  13. local scale = 20
  14. local rs = Instance.new(motor)
  15. rs.Name = "Right Shoulder"
  16. rs.MaxVelocity = 20/45*0.1
  17. rs.Part0 = tor
  18. rs.Part1 = ra
  19. rs.C0 = CFrame.new(1*scale, 0.5*scale, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  20. rs.C1 = CFrame.new(-0.5*scale, 0.5*scale, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  21. rs.Parent = tor
  22. local ls = Instance.new(motor)
  23. ls.Name = "Left Shoulder"
  24. ls.MaxVelocity = 0.1
  25. ls.Part0 = tor
  26. ls.Part1 = la
  27. ls.C0 = CFrame.new(-1*scale, 0.5*scale, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  28. ls.C1 = CFrame.new(0.5*scale, 0.5*scale, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  29. ls.Parent = tor
  30. local rh = Instance.new(motor)
  31. rh.Name = "Right Hip"
  32. rh.MaxVelocity = 0.1
  33. rh.Part0 = tor
  34. rh.Part1 = rl
  35. rh.C0 = CFrame.new(1*scale, -1*scale, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  36. rh.C1 = CFrame.new(0.5*scale, 1*scale, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  37. rh.Parent = tor
  38. local lh = Instance.new(motor)
  39. lh.Name = "Left Hip"
  40. lh.MaxVelocity = 0.1
  41. lh.Part0 = tor
  42. lh.Part1 = ll
  43. lh.C0 = CFrame.new(-1*scale, -1*scale, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  44. lh.C1 = CFrame.new(-0.5*scale, 1*scale, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  45. lh.Parent = tor
  46. for i = 1, 2 do
  47. local w = Instance.new("Weld")
  48. w.Part0 = ra
  49. if i == 1 then
  50. w.Part1 = han
  51. else
  52. w.Part1 = blade
  53. end
  54. w.C1 = (CFrame.new(0,-0.875*scale,-1.75*scale)*CFrame.Angles(0,math.rad(180),0)):inverse()
  55. w.Parent = tor
  56. end
  57.  
  58. function Down(key)
  59. if key == "Up" then
  60. return seat.Throttle == 1
  61. elseif key == "Down" then
  62. return seat.Throttle == -1
  63. elseif key == "Right" then
  64. return seat.Steer == 1
  65. elseif key == "Left" then
  66. return seat.Steer == -1
  67. end
  68. end
  69.  
  70. local moving
  71. local last = 0
  72. local add = 1
  73.  
  74. while true do
  75. bv.velocity = tor.CFrame.lookVector*16*scale*seat.Throttle
  76. bg.cframe = tor.CFrame*CFrame.Angles(0,math.rad(seat.Steer*-10),0)
  77. if seat.Throttle ~= 0 then
  78. if last == 0 then
  79. ls.DesiredAngle = math.rad(-45)
  80. rs.DesiredAngle = math.rad(70)
  81. lh.DesiredAngle = math.rad(45)
  82. rh.DesiredAngle = math.rad(45)
  83. add = 1
  84. elseif last == 20 then
  85. ls.DesiredAngle = math.rad(45)
  86. rs.DesiredAngle = math.rad(110)
  87. lh.DesiredAngle = math.rad(-45)
  88. rh.DesiredAngle = math.rad(-45)
  89. add = -1
  90. end
  91. last = last + add
  92. else
  93. last = 0
  94. add = 1
  95. ls.DesiredAngle = math.rad(0)
  96. rs.DesiredAngle = math.rad(90)
  97. lh.DesiredAngle = 0
  98. rh.DesiredAngle = 0
  99. end
  100. wait()
  101. end
  102. --[[
  103. seat.Changed:connect(function(c)
  104. if c == "Steer" or c == "Throttle" then
  105. if c == "Steer" then
  106. if seat.Steer == 1 then
  107. onDown("Up")
  108. else
  109. onDown("Down")
  110. end
  111. else
  112. if seat.Throttle == 1 then
  113. onDown("Right")
  114. else
  115. onDown("Left")
  116. end
  117. end
  118. end
  119. end)]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement