lafur

Untitled

Jan 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. --Start Naming Main variables--
  2. MSCRIPT3 = script
  3. script = script.Parent
  4. --Above names script to the script's parent. that makes it easier.--
  5. Control = script.Control
  6. Torso = script.Torso.Main
  7. LarmM = script["Left Arm"]
  8. Larm = {
  9. Hand = LarmM.Hand,
  10. For = LarmM.For,
  11. Back = LarmM.Back
  12. }
  13. RarmM = script["Right Arm"]
  14. Rarm = {
  15. Hand = RarmM.Hand,
  16. For = RarmM.For,
  17. Back = RarmM.Back
  18. }
  19. legs = script.Legs
  20. Legs = {
  21. Left = legs["Left Leg"].Main,
  22. Right = legs["Right Leg"].Main
  23. }
  24. larg = {
  25. H = Larm.Hand.BodyGyro,
  26. F = Larm.For.BodyGyro,
  27. B = Larm.Back.BodyGyro
  28. }
  29. rarg = {
  30. H = Rarm.Hand.BodyGyro,
  31. F = Rarm.For.BodyGyro,
  32. B = Rarm.Back.BodyGyro
  33. }
  34. leg = {
  35. L = Legs.Right.BodyGyro,
  36. R = Legs.Left.BodyGyro
  37. }
  38. TG = Torso.BodyGyro
  39. TV = Torso.BodyVelocity
  40. TBAV = Torso.BodyAngularVelocity
  41. ---Finish of setting the main variables, long, huh?---
  42. local highest = math.rad(45)
  43. local add = math.rad(7)
  44. local Amount = 0
  45. local TS = false --Tool Selected
  46. local Sit = false
  47. script.TS.Changed:connect(function()
  48. TS = script.TS.Value
  49. end)
  50.  
  51. Control.ChildAdded:connect(function(c)
  52. local In = true
  53. Control.ChildRemoved:connect(function(cc)
  54. if cc == c then
  55. In = false
  56. end
  57. end)
  58. if c.Name == "SeatWeld" and c:IsA("Weld") then
  59. local plyr = game.Players:GetPlayerFromCharacter(c.Part1.Parent)
  60. if plyr == nil then plyr = game.Players:GetPlayerFromCharacter(c.Part0.Parent) end
  61. if plyr ~= nil then
  62. if plyr:findFirstChild("Backpack") == nil then return end
  63. if plyr.Character:findFirstChild("Right Arm") == nil then return end
  64. plyr.Character["Right Arm"].ChildAdded:connect(function(c)
  65. if In == false then return end
  66. if c.Name == "RightGrip" and c:IsA("Weld") then
  67. c.Part0 = RarmM.Hand
  68. LarmM.Hand:MakeJoints()
  69. script.TS.Value = true
  70. end
  71. end)
  72. plyr.Character["Right Arm"].ChildRemoved:connect(function(c)
  73. if In == false then return end
  74. if c.Name == "RightGrip" and c:IsA("Weld") then
  75. script.TS.Value = false
  76. end
  77. end)
  78. end
  79. end
  80. end)
  81.  
  82. Walk = function()
  83. if Amount >= highest or Amount <= -highest then
  84. add = -add
  85. end
  86. Amount = Amount+add
  87.  
  88.  
  89. leg.L.cframe = Torso.CFrame*CFrame.Angles(Amount,0,0)
  90. leg.R.cframe = Torso.CFrame*CFrame.Angles(-Amount,0,0)
  91.  
  92. larg.B.cframe = Torso.CFrame*CFrame.Angles(Amount,0,0)
  93. larg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(45/3),0,0)
  94.  
  95. if TS == false then
  96. rarg.B.cframe = Torso.CFrame*CFrame.Angles(-Amount,0,0)
  97. rarg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(45/3),0,0)
  98. else
  99. rarg.B.cframe = Torso.CFrame*CFrame.Angles(math.rad(45+45/2),0,0)
  100. rarg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(45),0,0)
  101. end
  102.  
  103. end
  104.  
  105.  
  106. Stand = function()
  107. leg.L.cframe = Torso.CFrame*CFrame.Angles(0,0,0)
  108. leg.R.cframe = Torso.CFrame*CFrame.Angles(0,0,0)
  109.  
  110. larg.B.cframe = Torso.CFrame*CFrame.Angles(0,0,0)
  111. larg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(-45),0,0)
  112.  
  113. rarg.B.cframe = Torso.CFrame*CFrame.Angles(0,0,0)
  114. rarg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(-45),0,0)
  115. if TS == true then
  116. rarg.B.cframe = Torso.CFrame*CFrame.Angles(math.rad(45+45/2),0,0)
  117. rarg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(45),0,0)
  118. end
  119. end
  120.  
  121. Sit = function()
  122. leg.L.cframe = Torso.CFrame*CFrame.Angles(math.rad(90),0,0)
  123. leg.R.cframe = Torso.CFrame*CFrame.Angles(math.rad(90),0,0)
  124.  
  125. larg.B.cframe = Torso.CFrame*CFrame.Angles(math.rad(45),0,0)
  126. larg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(90+45/2),0,0)
  127.  
  128. rarg.B.cframe = Torso.CFrame*CFrame.Angles(math.rad(45),0,0)
  129. rarg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(90+45/2),0,0)
  130. if TS == true then
  131. rarg.B.cframe = Torso.CFrame*CFrame.Angles(math.rad(45+45/2),0,0)
  132. rarg.F.cframe = Torso.CFrame*CFrame.Angles(math.rad(45),0,0)
  133. end
  134. end
  135.  
  136.  
  137. while true do
  138. TV.velocity = (Torso.CFrame.lookVector*script.WalkSpeed.Value)*Control.Throttle
  139. TBAV.angularvelocity = Vector3.new(0,-5,0)*Control.Steer
  140. rarg.H.cframe = rarg.F.cframe
  141. larg.H.cframe = larg.F.cframe
  142. if Control.Throttle ~= 0 then
  143. Walk()
  144. elseif Sit == true then
  145. Sit()
  146. else
  147. Stand()
  148. end
  149. wait()
  150. end
Add Comment
Please, Sign In to add comment