-- Services local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") -- Player references local player = Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local humanoid = char:WaitForChild("Humanoid") local root = char:WaitForChild("HumanoidRootPart") local mouse = player:GetMouse() -- GUI local screenGui = Instance.new("ScreenGui") screenGui.Name = "FlyToggleUI" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local button = Instance.new("TextButton") button.Name = "ToggleButton" button.Size = UDim2.new(0, 30, 0, 30) button.Position = UDim2.new(0, 20, 0, 100) button.BackgroundColor3 = Color3.fromRGB(255, 0, 0) button.Text = "🪽" button.TextColor3 = Color3.new(1, 1, 1) button.Font = Enum.Font.SourceSansBold button.TextScaled = true button.Active = true button.Draggable = true button.Parent = screenGui -- Flying variables local flying = false local deb = true local ctrl = {f = 0, b = 0, l = 0, r = 0} local lastctrl = {f = 0, b = 0, l = 0, r = 0} local flySpeed = 100 local KeyDownFunction = nil local KeyUpFunction = nil -- Fly Pad GUI (mobile-friendly) local Fly_Pad = Instance.new("ImageButton") local UIGradient = Instance.new("UIGradient") local FlyAButton = Instance.new("TextButton") local FlyDButton = Instance.new("TextButton") local FlyWButton = Instance.new("TextButton") local FlySButton = Instance.new("TextButton") Fly_Pad.Name = "Fly_Pad" Fly_Pad.Parent = screenGui Fly_Pad.AnchorPoint = Vector2.new(0, 1) Fly_Pad.BackgroundColor3 = Color3.fromRGB(255, 255, 255) Fly_Pad.BackgroundTransparency = 0.7 Fly_Pad.Position = UDim2.new(0, 20, 1, -20) Fly_Pad.Size = UDim2.new(0, 120, 0, 120) Fly_Pad.Visible = false Fly_Pad.Image = "rbxassetid://3570695787" Fly_Pad.ImageColor3 = Color3.fromRGB(0, 0, 0) Fly_Pad.ImageTransparency = 0.5 Fly_Pad.ScaleType = Enum.ScaleType.Slice Fly_Pad.SliceCenter = Rect.new(100, 100, 100, 100) Fly_Pad.SliceScale = 0.12 UIGradient.Color = ColorSequence.new{ ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(197, 197, 197)) } UIGradient.Parent = Fly_Pad local buttonSize = UDim2.new(0, 40, 0, 40) local buttonTransparency = 0.3 FlyAButton.Name = "FlyAButton" FlyAButton.Parent = Fly_Pad FlyAButton.AnchorPoint = Vector2.new(0.5, 0.5) FlyAButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) FlyAButton.BackgroundTransparency = buttonTransparency FlyAButton.Position = UDim2.new(0.2, 0, 0.5, 0) FlyAButton.Size = buttonSize FlyAButton.Font = Enum.Font.SourceSans FlyAButton.Text = "A" FlyAButton.TextColor3 = Color3.fromRGB(0, 0, 0) FlyAButton.TextScaled = true FlyAButton.TextWrapped = true FlyDButton.Name = "FlyDButton" FlyDButton.Parent = Fly_Pad FlyDButton.AnchorPoint = Vector2.new(0.5, 0.5) FlyDButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) FlyDButton.BackgroundTransparency = buttonTransparency FlyDButton.Position = UDim2.new(0.8, 0, 0.5, 0) FlyDButton.Size = buttonSize FlyDButton.Font = Enum.Font.SourceSans FlyDButton.Text = "D" FlyDButton.TextColor3 = Color3.fromRGB(0, 0, 0) FlyDButton.TextScaled = true FlyDButton.TextWrapped = true FlyWButton.Name = "FlyWButton" FlyWButton.Parent = Fly_Pad FlyWButton.AnchorPoint = Vector2.new(0.5, 0.5) FlyWButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) FlyWButton.BackgroundTransparency = buttonTransparency FlyWButton.Position = UDim2.new(0.5, 0, 0.2, 0) FlyWButton.Size = buttonSize FlyWButton.Font = Enum.Font.SourceSans FlyWButton.Text = "W" FlyWButton.TextColor3 = Color3.fromRGB(0, 0, 0) FlyWButton.TextScaled = true FlyWButton.TextWrapped = true FlySButton.Name = "FlySButton" FlySButton.Parent = Fly_Pad FlySButton.AnchorPoint = Vector2.new(0.5, 0.5) FlySButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) FlySButton.BackgroundTransparency = buttonTransparency FlySButton.Position = UDim2.new(0.5, 0, 0.8, 0) FlySButton.Size = buttonSize FlySButton.Font = Enum.Font.SourceSans FlySButton.Text = "S" FlySButton.TextColor3 = Color3.fromRGB(0, 0, 0) FlySButton.TextScaled = true FlySButton.TextWrapped = true -- Update references on respawn local function updateCharacter(newChar) char = newChar humanoid = char:WaitForChild("Humanoid") root = char:WaitForChild("HumanoidRootPart") end player.CharacterAdded:Connect(updateCharacter) -- Animation functions local function PlayAnim(id,time,speed) pcall(function() player.Character.Animate.Disabled = false local hum = player.Character.Humanoid local animtrack = hum:GetPlayingAnimationTracks() for i,track in pairs(animtrack) do track:Stop() end player.Character.Animate.Disabled = true local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://"..id local loadanim = hum:LoadAnimation(Anim) loadanim:Play() loadanim.TimePosition = time loadanim:AdjustSpeed(speed) loadanim.Stopped:Connect(function() player.Character.Animate.Disabled = false for i, track in pairs (animtrack) do track:Stop() end end) end) end local function StopAnim() player.Character.Animate.Disabled = false local animtrack = player.Character.Humanoid:GetPlayingAnimationTracks() for i, track in pairs (animtrack) do track:Stop() end end -- Fly Pad button connections FlyAButton.MouseButton1Down:Connect(function() ctrl.l = -1 PlayAnim(10147823318,3.55,0) end) FlyAButton.MouseButton1Up:Connect(function () ctrl.l = 0 PlayAnim(10714347256,4,0) end) FlySButton.MouseButton1Down:Connect(function() ctrl.b = -1 PlayAnim(10147823318,4.11,0) end) FlySButton.MouseButton1Up:Connect(function () ctrl.b = 0 PlayAnim(10714347256,4,0) end) FlyDButton.MouseButton1Down:Connect(function() ctrl.r = 1 PlayAnim(10147823318,4.81,0) end) FlyDButton.MouseButton1Up:Connect(function () ctrl.r = 0 PlayAnim(10714347256,4,0) end) FlyWButton.MouseButton1Down:Connect(function() ctrl.f = 1 PlayAnim(10714177846,4.65,0) end) FlyWButton.MouseButton1Up:Connect(function () ctrl.f = 0 PlayAnim(10714347256,4,0) end) -- Flying loop local function Fly() local UpperTorso = player.Character:WaitForChild("UpperTorso") local speed = 0 local bg = Instance.new("BodyGyro", UpperTorso) local bv = Instance.new("BodyVelocity", UpperTorso) bg.P = 9e4 bg.maxTorque = Vector3.new(9e9, 9e9, 9e9) bg.cframe = UpperTorso.CFrame bv.velocity = Vector3.new(0,0.1,0) bv.maxForce = Vector3.new(9e9, 9e9, 9e9) PlayAnim(10714347256,4,0) player.Character.Humanoid.PlatformStand = true local connection connection = RunService.RenderStepped:Connect(function() if not flying then -- Cleanup immediately player.Character.Humanoid.PlatformStand = false bg:Destroy() bv:Destroy() connection:Disconnect() return end -- Speed smoothing if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then speed = speed + flySpeed*0.10 if speed > flySpeed then speed = flySpeed end elseif speed ~= 0 then speed = speed - flySpeed*0.10 if speed < 0 then speed = 0 end end -- Velocity if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then bv.velocity = ((game.Workspace.CurrentCamera.CFrame.LookVector * (ctrl.f+ctrl.b)) + ((game.Workspace.CurrentCamera.CFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CFrame.p))*speed lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r} elseif speed ~= 0 then bv.velocity = ((game.Workspace.CurrentCamera.CFrame.LookVector * (lastctrl.f+lastctrl.b)) + ((game.Workspace.CurrentCamera.CFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CFrame.p))*speed else bv.velocity = Vector3.new(0,0.1,0) end bg.cframe = game.Workspace.CurrentCamera.CFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/flySpeed),0,0) end) end -- Toggle flying button.MouseButton1Click:Connect(function() if flying then flying = false Fly_Pad.Visible = false if KeyDownFunction then KeyDownFunction:Disconnect() end if KeyUpFunction then KeyUpFunction:Disconnect() end StopAnim() -- Immediate cleanup if player.Character and player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.PlatformStand = false end button.BackgroundColor3 = Color3.fromRGB(255,0,0) else flying = true if UserInputService.TouchEnabled then Fly_Pad.Visible = true end KeyDownFunction = mouse.KeyDown:Connect(function(key) if key:lower() == "w" then ctrl.f = 1 PlayAnim(10714177846,4.65,0) elseif key:lower() == "s" then ctrl.b = -1 PlayAnim(10147823318,4.11,0) elseif key:lower() == "a" then ctrl.l = -1 PlayAnim(10147823318,3.55,0) elseif key:lower() == "d" then ctrl.r = 1 PlayAnim(10147823318,4.81,0) end end) KeyUpFunction = mouse.KeyUp:Connect(function(key) if key:lower() == "w" then ctrl.f = 0 PlayAnim(10714347256,4,0) elseif key:lower() == "s" then ctrl.b = 0 PlayAnim(10714347256,4,0) elseif key:lower() == "a" then ctrl.l = 0 PlayAnim(10714347256,4,0) elseif key:lower() == "d" then ctrl.r = 0 PlayAnim(10714347256,4,0) end end) Fly() button.BackgroundColor3 = Color3.fromRGB(0,255,0) end end)