Advertisement
-ascriptprovider-

fly in seat

May 25th, 2022
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.73 KB | None | 0 0
  1. game.Workspace.Part.Anchored = true
  2. if game.Workspace.Part.Anchored == true then
  3. wait(10)
  4. game.Workspace.Part.Anchored = false
  5.  
  6. if game.Players.LocalPlayer.Character.Humanoid.Seated == true then  --[ Detects if your humanoid is currently sitting or not ]--
  7. if game.Players.LocalPlayer.Character.Humanoid.SeatPart.Anchored == true then --[ It then detects if the SeatPart is Anchored ]--
  8. game.Players.LocalPlayer.Character.Humanoid.SeatPart.Anchored = false --[ Changes the value to false so now the seat is UnAnchored ]--
  9. end
  10. end
  11.  
  12. if game.Players.LocalPlayer.Character.Humanoid.Seated == true then
  13. game.Players.LocalPlayer.Humanoid.RootPart.Anchored = true
  14. game.Players.LocalPlayer.PlayerScripts.ControlScript.Disabled = true -- I think this disables you from moving though
  15. end
  16. end
  17.  
  18. game:GetService('Players').LocalPlayer.Character.Humanoid.Name = "Humanoida"
  19. repeat wait()
  20. until game:GetService"Players".LocalPlayer and game:GetService"Players".LocalPlayer.Character and game:GetService"Players".LocalPlayer.Character:findFirstChild("UpperTorso") and game:GetService"Players".LocalPlayer.Character:findFirstChild("Humanoida")
  21. local mouse = game:GetService"Players".LocalPlayer:GetMouse()
  22. repeat wait() until mouse
  23. local plr = game:GetService"Players".LocalPlayer
  24. local torso = plr.Character.UpperTorso
  25. local flying = true
  26. local deb = true
  27. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  28. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  29. local maxspeed = 100
  30. local speed = 0
  31.  
  32. function Fly()
  33. local bg = Instance.new("BodyGyro", torso)
  34. bg.P = 9e4
  35. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  36. bg.cframe = torso.CFrame
  37. local bv = Instance.new("BodyVelocity", torso)
  38. bv.velocity = Vector3.new(0,0.1,0)
  39. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  40. repeat wait()
  41. --plr.Character.Humanoida.PlatformStand = true
  42. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  43. speed = speed+.5+(speed/maxspeed)
  44. if speed > maxspeed then
  45. speed = maxspeed
  46. end
  47. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  48. speed = speed-1
  49. if speed < 0 then
  50. speed = 0
  51. end
  52. end
  53. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  54. bv.velocity = ((game:GetService("Workspace").CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game:GetService("Workspace").CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game:GetService("Workspace").CurrentCamera.CoordinateFrame.p))*speed
  55. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  56. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  57. bv.velocity = ((game:GetService("Workspace").CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game:GetService("Workspace").CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game:GetService("Workspace").CurrentCamera.CoordinateFrame.p))*speed
  58. else
  59. bv.velocity = Vector3.new(0,0.1,0)
  60. end
  61. bg.cframe = game:GetService("Workspace").CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  62. until not flying
  63. ctrl = {f = 0, b = 0, l = 0, r = 0}
  64. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  65. speed = 0
  66. bg:Destroy()
  67. bv:Destroy()
  68. --plr.Character.Humanoida.PlatformStand = false
  69. end
  70. mouse.KeyDown:connect(function(key)
  71. if key:lower() == "e" then
  72. if flying then flying = false
  73. else
  74. flying = true
  75. Fly()
  76. end
  77. elseif key:lower() == "w" then
  78. ctrl.f = 1
  79. elseif key:lower() == "s" then
  80. ctrl.b = -1
  81. elseif key:lower() == "a" then
  82. ctrl.l = -1
  83. elseif key:lower() == "d" then
  84. ctrl.r = 1
  85. end
  86. end)
  87. mouse.KeyUp:connect(function(key)
  88. if key:lower() == "w" then
  89. ctrl.f = 0
  90. elseif key:lower() == "s" then
  91. ctrl.b = 0
  92. elseif key:lower() == "a" then
  93. ctrl.l = 0
  94. elseif key:lower() == "d" then
  95. ctrl.r = 0
  96. end
  97. end)
  98. Fly()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement