racemodex

da hood fly script (x)

Jul 23rd, 2020 (edited)
22,099
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local mouse = plr:GetMouse()
  3. local Humanoid = game.Players.LocalPlayer.Character.Humanoid or game.Players.LocalPlayer.Character.humanoid
  4.  
  5. localplayer = plr
  6.  
  7. if workspace:FindFirstChild("Core") then
  8. workspace.Core:Destroy()
  9. end
  10.  
  11. local Core = Instance.new("Part")
  12. Core.Name = "Core"
  13. Core.Size = Vector3.new(0.05, 0.05, 0.05)
  14.  
  15. spawn(function()
  16. Core.Parent = workspace
  17. local Weld = Instance.new("Weld", Core)
  18. Weld.Part0 = Core
  19. Weld.Part1 = localplayer.Character.LowerTorso
  20. Weld.C0 = CFrame.new(0, 0, 0)
  21. end)
  22.  
  23. workspace:WaitForChild("Core")
  24.  
  25. local torso = workspace.Core
  26. flying = true
  27. local speed=10
  28. local keys={a=false,d=false,w=false,s=false}
  29. local e1
  30. local e2
  31. local function start()
  32. local pos = Instance.new("BodyPosition",torso)
  33. local gyro = Instance.new("BodyGyro",torso)
  34. pos.Name="EPIXPOS"
  35. pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  36. pos.position = torso.Position
  37. gyro.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  38. gyro.cframe = torso.CFrame
  39. repeat
  40. wait()
  41. Humanoid.PlatformStand=true
  42. local new=gyro.cframe - gyro.cframe.p + pos.position
  43. if not keys.w and not keys.s and not keys.a and not keys.d then
  44. speed=5
  45. end
  46. if keys.w then
  47. new = new + workspace.CurrentCamera.CoordinateFrame.lookVector * speed
  48. speed=speed+0
  49. end
  50. if keys.s then
  51. new = new - workspace.CurrentCamera.CoordinateFrame.lookVector * speed
  52. speed=speed+0
  53. end
  54. if keys.d then
  55. new = new * CFrame.new(speed,0,0)
  56. speed=speed+0
  57. end
  58. if keys.a then
  59. new = new * CFrame.new(-speed,0,0)
  60. speed=speed+0
  61. end
  62. if speed>10 then
  63. speed=5
  64. end
  65. pos.position=new.p
  66. if keys.w then
  67. gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(-math.rad(speed*0),0,0)
  68. elseif keys.s then
  69. gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(math.rad(speed*0),0,0)
  70. else
  71. gyro.cframe = workspace.CurrentCamera.CoordinateFrame
  72. end
  73. until flying == false
  74. if gyro then gyro:Destroy() end
  75. if pos then pos:Destroy() end
  76. flying=false
  77. Humanoid.PlatformStand=false
  78. speed=10
  79. end
  80. e1=mouse.KeyDown:connect(function(key)
  81. if not torso or not torso.Parent then flying=false e1:disconnect() e2:disconnect() return end
  82. if key=="w" then
  83. keys.w=true
  84. elseif key=="s" then
  85. keys.s=true
  86. elseif key=="a" then
  87. keys.a=true
  88. elseif key=="d" then
  89. keys.d=true
  90. elseif key=="x" then
  91. if flying==true then
  92. flying=false
  93. else
  94. flying=true
  95. start()
  96. end
  97. end
  98. end)
  99. e2=mouse.KeyUp:connect(function(key)
  100. if key=="w" then
  101. keys.w=false
  102. elseif key=="s" then
  103. keys.s=false
  104. elseif key=="a" then
  105. keys.a=false
  106. elseif key=="d" then
  107. keys.d=false
  108. end
  109. end)
  110. start()
Add Comment
Please, Sign In to add comment