xvc200

btw

Aug 3rd, 2025 (edited)
11,830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.56 KB | None | 0 0
  1. --protect ui function
  2. function protectUI(sGui)
  3. local function blankfunction(...)
  4. return ...
  5. end
  6.  
  7. local cloneref = cloneref or blankfunction
  8.  
  9. local function SafeGetService(service)
  10. return cloneref(game:GetService(service)) or game:GetService(service)
  11. end
  12.  
  13. local cGUI = SafeGetService("CoreGui")
  14. local rPlr = SafeGetService("Players"):FindFirstChildWhichIsA("Player")
  15. local cGUIProtect = {}
  16. local rService = SafeGetService("RunService")
  17. local lPlr = SafeGetService("Players").LocalPlayer
  18.  
  19. local function NAProtection(inst, var)
  20. if inst then
  21. if var then
  22. inst[var] = "\0"
  23. inst.Archivable = false
  24. else
  25. inst.Name = "\0"
  26. inst.Archivable = false
  27. end
  28. end
  29. end
  30.  
  31. if (get_hidden_gui or gethui) then
  32. local hiddenUI = (get_hidden_gui or gethui)
  33. NAProtection(sGui)
  34. sGui.Parent = hiddenUI()
  35. return sGui
  36. elseif (not is_sirhurt_closure) and (syn and syn.protect_gui) then
  37. NAProtection(sGui)
  38. syn.protect_gui(sGui)
  39. sGui.Parent = cGUI
  40. return sGui
  41. elseif cGUI:FindFirstChildWhichIsA("ScreenGui") then
  42. pcall(function()
  43. for _, v in pairs(sGui:GetDescendants()) do
  44. cGUIProtect[v] = rPlr.Name
  45. end
  46. sGui.DescendantAdded:Connect(function(v)
  47. cGUIProtect[v] = rPlr.Name
  48. end)
  49. cGUIProtect[sGui] = rPlr.Name
  50.  
  51. local meta = getrawmetatable(game)
  52. local tostr = meta.__tostring
  53. setreadonly(meta, false)
  54. meta.__tostring = newcclosure(function(t)
  55. if cGUIProtect[t] and not checkcaller() then
  56. return cGUIProtect[t]
  57. end
  58. return tostr(t)
  59. end)
  60. end)
  61. if not rService:IsStudio() then
  62. local newGui = cGUI:FindFirstChildWhichIsA("ScreenGui")
  63. newGui.DescendantAdded:Connect(function(v)
  64. cGUIProtect[v] = rPlr.Name
  65. end)
  66. for _, v in pairs(sGui:GetChildren()) do
  67. v.Parent = newGui
  68. end
  69. sGui = newGui
  70. end
  71. return sGui
  72. elseif cGUI then
  73. NAProtection(sGui)
  74. sGui.Parent = cGUI
  75. return sGui
  76. elseif lPlr and lPlr:FindFirstChild("PlayerGui") then
  77. NAProtection(sGui)
  78. sGui.Parent = lPlr:FindFirstChild("PlayerGui")
  79. return sGui
  80. else
  81. return nil
  82. end
  83. end
  84.  
  85. local savedSpeed = 50
  86.  
  87. local function gui()
  88. local Players = game:GetService("Players")
  89. local RunService = game:GetService("RunService")
  90. local UserInputService = game:GetService("UserInputService")
  91. local player = Players.LocalPlayer
  92. local character = player.Character or player.CharacterAdded:Wait()
  93. local humanoid = character:WaitForChild("Humanoid")
  94. local HRP = character:WaitForChild("HumanoidRootPart")
  95. local Camera = workspace.CurrentCamera
  96.  
  97. local baseSpeed = savedSpeed
  98. local flySpeed = baseSpeed
  99. local flying = false
  100. local forwardHold = 0
  101. local inputFlags = { forward = false, back = false, left = false, right = false, up = false, down = false }
  102.  
  103. local bodyVelocity = Instance.new("BodyVelocity")
  104. bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
  105.  
  106. local bodyGyro = Instance.new("BodyGyro")
  107. bodyGyro.MaxTorque = Vector3.new(1e5, 1e5, 1e5)
  108.  
  109. local flyskibidi = Instance.new("ScreenGui")
  110. flyskibidi.Name = "FlyScreenGui"
  111. flyskibidi.ResetOnSpawn = false
  112. protectUI(flyskibidi)
  113.  
  114. local toggleButton = Instance.new("TextButton")
  115. toggleButton.Name = "ToggleFlyButton"
  116. toggleButton.Text = "Fly OFF"
  117. toggleButton.Size = UDim2.new(0, 100, 0, 50)
  118. toggleButton.Position = UDim2.new(1, -220, 0, 10)
  119. toggleButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  120. toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  121. toggleButton.Font = Enum.Font.GothamBold
  122. toggleButton.TextScaled = true
  123. toggleButton.BackgroundTransparency = 0.2
  124. toggleButton.Parent = flyskibidi
  125.  
  126. local speedBox = Instance.new("TextBox")
  127. speedBox.Name = "SpeedBox"
  128. speedBox.Text = tostring(baseSpeed)
  129. speedBox.Size = UDim2.new(0, 100, 0, 50)
  130. speedBox.Position = UDim2.new(1, -110, 0, 10)
  131. speedBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  132. speedBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  133. speedBox.Font = Enum.Font.GothamBold
  134. speedBox.TextScaled = true
  135. speedBox.BackgroundTransparency = 0.2
  136. speedBox.Parent = flyskibidi
  137.  
  138. local function newAnim(id)
  139. local anim = Instance.new("Animation")
  140. anim.AnimationId = "rbxassetid://" .. id
  141. return anim
  142. end
  143.  
  144. local animations = {
  145. forward = newAnim(90872539),
  146. up = newAnim(90872539),
  147. right1 = newAnim(136801964),
  148. right2 = newAnim(142495255),
  149. left1 = newAnim(136801964),
  150. left2 = newAnim(142495255),
  151. flyLow1 = newAnim(97169019),
  152. flyLow2 = newAnim(282574440),
  153. flyFast = newAnim(282574440),
  154. back1 = newAnim(136801964),
  155. back2 = newAnim(106772613),
  156. back3 = newAnim(42070810),
  157. back4 = newAnim(214744412),
  158. down = newAnim(233322916),
  159. idle1 = newAnim(97171309)
  160. }
  161.  
  162. local tracks = {}
  163. for name, anim in pairs(animations) do
  164. tracks[name] = humanoid:LoadAnimation(anim)
  165. end
  166.  
  167. local function stopAll()
  168. for _, track in pairs(tracks) do
  169. track:Stop()
  170. end
  171. end
  172.  
  173. local function startFlying()
  174. flying = true
  175. forwardHold = 0
  176. flySpeed = baseSpeed
  177. bodyVelocity.Parent = HRP
  178. bodyGyro.Parent = HRP
  179. humanoid.PlatformStand = true
  180. end
  181.  
  182. local function stopFlying()
  183. flying = false
  184. bodyVelocity.Parent = nil
  185. bodyGyro.Parent = nil
  186. humanoid.PlatformStand = false
  187. stopAll()
  188. end
  189.  
  190. toggleButton.MouseButton1Click:Connect(function()
  191. if flying then
  192. stopFlying()
  193. toggleButton.Text = "Fly OFF"
  194. else
  195. startFlying()
  196. toggleButton.Text = "Fly ON"
  197. end
  198. end)
  199.  
  200. speedBox.FocusLost:Connect(function()
  201. local num = tonumber(speedBox.Text)
  202. if num and num > 0 then
  203. baseSpeed = num
  204. savedSpeed = num
  205. if flying then flySpeed = baseSpeed end
  206. else
  207. speedBox.Text = tostring(baseSpeed)
  208. end
  209. end)
  210.  
  211. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  212. if gameProcessed then return end
  213. if input.KeyCode == Enum.KeyCode.W then inputFlags.forward = true end
  214. if input.KeyCode == Enum.KeyCode.S then inputFlags.back = true end
  215. if input.KeyCode == Enum.KeyCode.A then inputFlags.left = true end
  216. if input.KeyCode == Enum.KeyCode.D then inputFlags.right = true end
  217. if input.KeyCode == Enum.KeyCode.E then inputFlags.up = true end
  218. if input.KeyCode == Enum.KeyCode.Q then inputFlags.down = true end
  219. end)
  220.  
  221. UserInputService.InputEnded:Connect(function(input)
  222. if input.KeyCode == Enum.KeyCode.W then inputFlags.forward = false end
  223. if input.KeyCode == Enum.KeyCode.S then inputFlags.back = false end
  224. if input.KeyCode == Enum.KeyCode.A then inputFlags.left = false end
  225. if input.KeyCode == Enum.KeyCode.D then inputFlags.right = false end
  226. if input.KeyCode == Enum.KeyCode.E then inputFlags.up = false end
  227. if input.KeyCode == Enum.KeyCode.Q then inputFlags.down = false end
  228. end)
  229.  
  230. RunService.RenderStepped:Connect(function(dt)
  231. if not flying then return end
  232.  
  233. if not inputFlags.forward then forwardHold = 0 end
  234.  
  235. local dir = Vector3.zero
  236. local camCF = Camera.CFrame
  237.  
  238. if inputFlags.forward then dir += camCF.LookVector end
  239. if inputFlags.back then dir -= camCF.LookVector end
  240. if inputFlags.left then dir -= camCF.RightVector end
  241. if inputFlags.right then dir += camCF.RightVector end
  242. if inputFlags.up then dir += Vector3.yAxis end
  243. if inputFlags.down then dir -= Vector3.yAxis end
  244.  
  245. if dir.Magnitude > 0 then dir = dir.Unit end
  246.  
  247. bodyVelocity.Velocity = dir * flySpeed
  248. bodyGyro.CFrame = camCF
  249.  
  250. if inputFlags.up then
  251. if not tracks.up.IsPlaying then stopAll(); tracks.up:Play() end
  252. elseif inputFlags.down then
  253. if not tracks.down.IsPlaying then stopAll(); tracks.down:Play() end
  254. elseif inputFlags.left then
  255. if not tracks.left1.IsPlaying then
  256. stopAll()
  257. tracks.left1:Play(); tracks.left1.TimePosition = 2.0; tracks.left1:AdjustSpeed(0)
  258. tracks.left2:Play(); tracks.left2.TimePosition = 0.5; tracks.left2:AdjustSpeed(0)
  259. end
  260. elseif inputFlags.right then
  261. if not tracks.right1.IsPlaying then
  262. stopAll()
  263. tracks.right1:Play(); tracks.right1.TimePosition = 1.1; tracks.right1:AdjustSpeed(0)
  264. tracks.right2:Play(); tracks.right2.TimePosition = 0.5; tracks.right2:AdjustSpeed(0)
  265. end
  266. elseif inputFlags.back then
  267. if not tracks.back1.IsPlaying then
  268. stopAll()
  269. tracks.back1:Play(); tracks.back1.TimePosition = 5.3; tracks.back1:AdjustSpeed(0)
  270. tracks.back2:Play(); tracks.back2:AdjustSpeed(0)
  271. tracks.back3:Play(); tracks.back3.TimePosition = 0.8; tracks.back3:AdjustSpeed(0)
  272. tracks.back4:Play(); tracks.back4.TimePosition = 1; tracks.back4:AdjustSpeed(0)
  273. end
  274. elseif inputFlags.forward then
  275. forwardHold += dt
  276. if forwardHold >= 3 then
  277. if not tracks.flyFast.IsPlaying then
  278. stopAll()
  279. flySpeed = baseSpeed * 1.3
  280. tracks.flyFast:Play(); tracks.flyFast:AdjustSpeed(0.05)
  281. end
  282. else
  283. if not tracks.flyLow1.IsPlaying then
  284. stopAll()
  285. flySpeed = baseSpeed
  286. tracks.flyLow1:Play()
  287. tracks.flyLow2:Play()
  288. end
  289. end
  290. else
  291. if not tracks.idle1.IsPlaying then
  292. stopAll()
  293. tracks.idle1:Play(); tracks.idle1:AdjustSpeed(0)
  294. end
  295. end
  296. end)
  297. end
  298.  
  299. gui()
Advertisement
Add Comment
Please, Sign In to add comment