Skip to content

hi #32

@arnitrag-cell

Description

@arnitrag-cell

-- Roblox Mobile Fly Client
-- Place this in StarterPlayer > StarterPlayerScripts

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

-- Configuration
local FLY_SPEED = 50
local MOBILE_BUTTON_SIZE = UDim2.new(0, 70, 0, 70)

local flying = false
local bodyVelocity
local bodyGyro

-- Create GUI
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FlyGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")

-- Fly Toggle Button
local flyButton = Instance.new("TextButton")
flyButton.Name = "FlyButton"
flyButton.Size = MOBILE_BUTTON_SIZE
flyButton.Position = UDim2.new(0, 10, 0, 10)
flyButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
flyButton.BackgroundTransparency = 0.2
flyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
flyButton.TextSize = 18
flyButton.Font = Enum.Font.GothamBold
flyButton.Text = "FLY\nOFF"
flyButton.BorderSizePixel = 0
flyButton.Parent = screenGui

-- Corner radius effect
local corner1 = Instance.new("UICorner")
corner1.CornerRadius = UDim.new(0, 15)
corner1.Parent = flyButton

-- Stroke effect
local stroke1 = Instance.new("UIStroke")
stroke1.Color = Color3.fromRGB(0, 200, 255)
stroke1.Thickness = 2
stroke1.Parent = flyButton

-- Movement Joystick Background
local joystickBg = Instance.new("ImageLabel")
joystickBg.Name = "JoystickBg"
joystickBg.Size = UDim2.new(0, 120, 0, 120)
joystickBg.Position = UDim2.new(0, 10, 0.5, -60)
joystickBg.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
joystickBg.BackgroundTransparency = 0.5
joystickBg.BorderSizePixel = 0
joystickBg.Parent = screenGui

local cornerJoy = Instance.new("UICorner")
cornerJoy.CornerRadius = UDim.new(0, 60)
cornerJoy.Parent = joystickBg

-- Joystick Thumb
local joystickThumb = Instance.new("ImageLabel")
joystickThumb.Name = "JoystickThumb"
joystickThumb.Size = UDim2.new(0, 60, 0, 60)
joystickThumb.Position = UDim2.new(0, 30, 0, 30)
joystickThumb.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
joystickThumb.BackgroundTransparency = 0.3
joystickThumb.BorderSizePixel = 0
joystickThumb.Parent = joystickBg

local cornerThumb = Instance.new("UICorner")
cornerThumb.CornerRadius = UDim.new(0, 30)
cornerThumb.Parent = joystickThumb

-- Vertical Control Buttons (Up/Down)
local upButton = Instance.new("TextButton")
upButton.Name = "UpButton"
upButton.Size = MOBILE_BUTTON_SIZE
upButton.Position = UDim2.new(1, -90, 0, 90)
upButton.BackgroundColor3 = Color3.fromRGB(0, 200, 100)
upButton.BackgroundTransparency = 0.2
upButton.TextColor3 = Color3.fromRGB(255, 255, 255)
upButton.TextSize = 24
upButton.Font = Enum.Font.GothamBold
upButton.Text = "⬆"
upButton.BorderSizePixel = 0
upButton.Parent = screenGui

local cornerUp = Instance.new("UICorner")
cornerUp.CornerRadius = UDim.new(0, 15)
cornerUp.Parent = upButton

-- Down Button
local downButton = Instance.new("TextButton")
downButton.Name = "DownButton"
downButton.Size = MOBILE_BUTTON_SIZE
downButton.Position = UDim2.new(1, -90, 0, 170)
downButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
downButton.BackgroundTransparency = 0.2
downButton.TextColor3 = Color3.fromRGB(255, 255, 255)
downButton.TextSize = 24
downButton.Font = Enum.Font.GothamBold
downButton.Text = "⬇"
downButton.BorderSizePixel = 0
downButton.Parent = screenGui

local cornerDown = Instance.new("UICorner")
cornerDown.CornerRadius = UDim.new(0, 15)
cornerDown.Parent = downButton

-- Speed Display
local speedLabel = Instance.new("TextLabel")
speedLabel.Name = "SpeedLabel"
speedLabel.Size = UDim2.new(0, 150, 0, 50)
speedLabel.Position = UDim2.new(0.5, -75, 0, 10)
speedLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
speedLabel.BackgroundTransparency = 0.5
speedLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
speedLabel.TextSize = 16
speedLabel.Font = Enum.Font.GothamBold
speedLabel.Text = "Speed: 50"
speedLabel.BorderSizePixel = 0
speedLabel.Parent = screenGui

local cornerSpeed = Instance.new("UICorner")
cornerSpeed.CornerRadius = UDim.new(0, 10)
cornerSpeed.Parent = speedLabel

-- Speed Slider
local speedSlider = Instance.new("Frame")
speedSlider.Name = "SpeedSlider"
speedSlider.Size = UDim2.new(0, 200, 0, 40)
speedSlider.Position = UDim2.new(0.5, -100, 0, 65)
speedSlider.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
speedSlider.BackgroundTransparency = 0.5
speedSlider.BorderSizePixel = 0
speedSlider.Parent = screenGui

local cornerSlider = Instance.new("UICorner")
cornerSlider.CornerRadius = UDim.new(0, 10)
cornerSlider.Parent = speedSlider

local sliderButton = Instance.new("TextButton")
sliderButton.Name = "SliderButton"
sliderButton.Size = UDim2.new(0, 30, 0, 30)
sliderButton.Position = UDim2.new(0, 85, 0, 5)
sliderButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
sliderButton.TextSize = 0
sliderButton.BorderSizePixel = 0
sliderButton.Parent = speedSlider

local cornerSliderBtn = Instance.new("UICorner")
cornerSliderBtn.CornerRadius = UDim.new(0, 15)
cornerSliderBtn.Parent = sliderButton

-- Variables
local moveDirection = Vector3.new(0, 0, 0)
local verticalInput = 0

-- Function to start flying
local function startFlying()
if flying then return end
flying = true

humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if not humanoidRootPart then return end

-- Create BodyVelocity
bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = Vector3.new(0, 0, 0)
bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyVelocity.Parent = humanoidRootPart

-- Create BodyGyro
bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bodyGyro.P = 10000
bodyGyro.Parent = humanoidRootPart

flyButton.BackgroundColor3 = Color3.fromRGB(0, 200, 100)
flyButton.Text = "FLY\nON"

end

-- Function to stop flying
local function stopFlying()
if not flying then return end
flying = false

if bodyVelocity then
    bodyVelocity:Destroy()
    bodyVelocity = nil
end

if bodyGyro then
    bodyGyro:Destroy()
    bodyGyro = nil
end

moveDirection = Vector3.new(0, 0, 0)
verticalInput = 0

flyButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
flyButton.Text = "FLY\nOFF"

end

-- Fly Button Pressed
flyButton.MouseButton1Click:Connect(function()
if flying then
stopFlying()
else
startFlying()
end
end)

-- Joystick Input
local joystickActive = false
local joystickStartPos = Vector2.new(0, 0)

joystickBg.InputBegan:Connect(function(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Touch then
joystickActive = true
joystickStartPos = input.Position
end
end)

joystickBg.InputEnded:Connect(function(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Touch then
joystickActive = false
joystickThumb.Position = UDim2.new(0, 30, 0, 30)
moveDirection = Vector3.new(0, 0, 0)
end
end)

joystickBg.InputChanged:Connect(function(input, gameProcessed)
if joystickActive and input.UserInputType == Enum.UserInputType.Touch then
local delta = input.Position - joystickStartPos
local magnitude = delta.Magnitude
local maxRadius = 40

    if magnitude > maxRadius then
        delta = (delta.Unit * maxRadius)
    end
    
    joystickThumb.Position = UDim2.new(0, 30 + delta.X, 0, 30 + delta.Y)
    
    -- Convert to movement direction
    local normalizedDelta = delta / maxRadius
    moveDirection = Vector3.new(normalizedDelta.X, 0, normalizedDelta.Y)
end

end)

-- Up Button
upButton.TouchBegan:Connect(function()
verticalInput = 1
end)

upButton.TouchEnded:Connect(function()
verticalInput = 0
end)

-- Down Button
downButton.TouchBegan:Connect(function()
verticalInput = -1
end)

downButton.TouchEnded:Connect(function()
verticalInput = 0
end)

-- Speed Slider
local sliderDragging = false

sliderButton.MouseButton1Down:Connect(function()
sliderDragging = true
end)

UserInputService.InputEnded:Connect(function(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
sliderDragging = false
end
end)

UserInputService.InputChanged:Connect(function(input, gameProcessed)
if sliderDragging and input.UserInputType == Enum.UserInputType.Mouse then
local mousePos = input.Position
local sliderPos = speedSlider.AbsolutePosition.X
local sliderSize = speedSlider.AbsoluteSize.X

    local relativeX = math.clamp(mousePos.X - sliderPos, 0, sliderSize - 30)
    local percentage = relativeX / (sliderSize - 30)
    
    FLY_SPEED = math.floor(percentage * 150 + 10)
    sliderButton.Position = UDim2.new(0, relativeX, 0, 5)
    speedLabel.Text = "Speed: " .. FLY_SPEED
end

end)

-- Main flying loop
RunService.RenderStepped:Connect(function()
if flying and bodyVelocity and bodyGyro and humanoidRootPart then
local camera = workspace.CurrentCamera

    -- Set direction based on camera
    bodyGyro.CFrame = camera.CFrame
    
    -- Calculate final movement
    local finalDirection = Vector3.new(0, 0, 0)
    
    if moveDirection.Magnitude > 0 then
        local forward = camera.CFrame.LookVector * moveDirection.Z
        local right = camera.CFrame.RightVector * moveDirection.X
        finalDirection = (forward + right).Unit
    end
    
    -- Add vertical input
    if verticalInput ~= 0 then
        finalDirection = finalDirection + Vector3.new(0, verticalInput, 0)
    end
    
    -- Normalize if has magnitude
    if finalDirection.Magnitude > 0 then
        finalDirection = finalDirection.Unit
    end
    
    bodyVelocity.Velocity = finalDirection * FLY_SPEED
end

end)

-- Handle character respawn
player.CharacterAdded:Connect(function(newCharacter)
stopFlying()
character = newCharacter
humanoidRootPart = character:WaitForChild("HumanoidRootPart")
end)

print("Mobile Fly Client Loaded! Press FLY button to start.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions