fly script
Key RequiredUniversal

fly script

Universal Scriptrafiqhy2rafiqhy2 1.5K views 30K executesUpdated Sep 25, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•213 lines (7409 chars)
--[[
    Made it by RafigHy 2
    Xeno UI Script (Fixed Responsive Fly & Noclip)
]]

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

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

-- Состояние
local flyEnabled = false
local noclipEnabled = false
local speed = 50
local minSpeed = 10
local maxSpeed = 500
local speedStep = 10

-- GUI Создание
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "RafigHyGui"
screenGui.ResetOnSpawn = false
if syn and syn.protect_gui then
    syn.protect_gui(screenGui)
    screenGui.Parent = game:GetService("CoreGui")
elseif gethui then
    screenGui.Parent = gethui()
else
    screenGui.Parent = game:GetService("CoreGui")
end

local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 230, 0, 165)
mainFrame.Position = UDim2.new(0.8, 0, 0.2, 0)
mainFrame.BackgroundColor3 = Color3.fromRGB(45, 25, 75)
mainFrame.BackgroundTransparency = 0.25
mainFrame.BorderSizePixel = 0
mainFrame.Active = true
mainFrame.Draggable = true
mainFrame.Parent = screenGui

local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0, 10)
uiCorner.Parent = mainFrame

local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, 0, 0, 30)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "RafigHy 2 Hub"
titleLabel.TextColor3 = Color3.fromRGB(220, 180, 255)
titleLabel.TextSize = 18
titleLabel.Font = Enum.Font.GothamBold
titleLabel.Parent = mainFrame

local flyStatus = Instance.new("TextLabel")
flyStatus.Size = UDim2.new(1, -20, 0, 20)
flyStatus.Position = UDim2.new(0, 10, 0, 35)
flyStatus.BackgroundTransparency = 1
flyStatus.TextXAlignment = Enum.TextXAlignment.Left
flyStatus.Text = "Fly [F]: OFF"
flyStatus.TextColor3 = Color3.fromRGB(255, 100, 100)
flyStatus.TextSize = 15
flyStatus.Font = Enum.Font.GothamBold
flyStatus.Parent = mainFrame

local noclipStatus = Instance.new("TextLabel")
noclipStatus.Size = UDim2.new(1, -20, 0, 20)
noclipStatus.Position = UDim2.new(0, 10, 0, 60)
noclipStatus.BackgroundTransparency = 1
noclipStatus.TextXAlignment = Enum.TextXAlignment.Left
noclipStatus.Text = "Noclip [N]: OFF"
noclipStatus.TextColor3 = Color3.fromRGB(255, 100, 100)
noclipStatus.TextSize = 15
noclipStatus.Font = Enum.Font.GothamBold
noclipStatus.Parent = mainFrame

local speedLabel = Instance.new("TextLabel")
speedLabel.Size = UDim2.new(1, -20, 0, 25)
speedLabel.Position = UDim2.new(0, 10, 0, 85)
speedLabel.BackgroundTransparency = 1
speedLabel.TextXAlignment = Enum.TextXAlignment.Left
speedLabel.Text = "Скорость [L/K]: " .. speed
speedLabel.TextColor3 = Color3.fromRGB(240, 240, 240)
speedLabel.TextSize = 15
speedLabel.Font = Enum.Font.GothamBold
speedLabel.Parent = mainFrame

local creditLabel = Instance.new("TextLabel")
creditLabel.Size = UDim2.new(1, 0, 0, 20)
creditLabel.Position = UDim2.new(0, 0, 1, -22)
creditLabel.BackgroundTransparency = 1
creditLabel.Text = "Made it by RafigHy 2"
creditLabel.TextColor3 = Color3.fromRGB(200, 150, 255)
creditLabel.TextSize = 12
creditLabel.Font = Enum.Font.GothamBold
creditLabel.Parent = mainFrame

-- Обновление персонажа при респавне
player.CharacterAdded:Connect(function(newChar)
    character = newChar
    humanoidRootPart = newChar:WaitForChild("HumanoidRootPart")
    humanoid = newChar:WaitForChild("Humanoid")
    flyEnabled = false
    noclipEnabled = false
    flyStatus.Text = "Fly [F]: OFF"
    flyStatus.TextColor3 = Color3.fromRGB(255, 100, 100)
    noclipStatus.Text = "Noclip [N]: OFF"
    noclipStatus.TextColor3 = Color3.fromRGB(255, 100, 100)
end)

-- Переключение функций клавишами
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    
    if input.KeyCode == Enum.KeyCode.F then
        flyEnabled = not flyEnabled
        if flyEnabled then
            flyStatus.Text = "Fly [F]: ON"
            flyStatus.TextColor3 = Color3.fromRGB(100, 255, 100)
        else
            flyStatus.Text = "Fly [F]: OFF"
            flyStatus.TextColor3 = Color3.fromRGB(255, 100, 100)
            humanoid.PlatformStand = false
            if humanoidRootPart:FindFirstChild("RafigFlyBV") then
                humanoidRootPart.RafigFlyBV:Destroy()
            end
            if humanoidRootPart:FindFirstChild("RafigFlyBG") then
                humanoidRootPart.RafigFlyBG:Destroy()
            end
        end
    elseif input.KeyCode == Enum.KeyCode.N then
        noclipEnabled = not noclipEnabled
        if noclipEnabled then
            noclipStatus.Text = "Noclip [N]: ON"
            noclipStatus.TextColor3 = Color3.fromRGB(100, 255, 100)
        else
            noclipStatus.Text = "Noclip [N]: OFF"
            noclipStatus.TextColor3 = Color3.fromRGB(255, 100, 100)
        end
    elseif input.KeyCode == Enum.KeyCode.L then
        speed = math.clamp(speed + speedStep, minSpeed, maxSpeed)
        speedLabel.Text = "Скорость [L/K]: " .. speed
    elseif input.KeyCode == Enum.KeyCode.K then
        speed = math.clamp(speed - speedStep, minSpeed, maxSpeed)
        speedLabel.Text = "Скорость [L/K]: " .. speed
    end
end)

-- Основной цикл обработки движения
RunService.RenderStepped:Connect(function()
    if not character or not humanoidRootPart or not humanoid then return end
    
    -- Noclip
    if noclipEnabled then
        for _, part in ipairs(character:GetDescendants()) do
            if part:IsA("BasePart") then
                part.CanCollide = false
            end
        end
    end
    
    -- Fly
    if flyEnabled then
        humanoid.PlatformStand = true
        
        local camera = workspace.CurrentCamera
        local bv = humanoidRootPart:FindFirstChild("RafigFlyBV")
        local bg = humanoidRootPart:FindFirstChild("RafigFlyBG")
        
        if not bv then
            bv = Instance.new("BodyVelocity")
            bv.Name = "RafigFlyBV"
            bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
            bv.Parent = humanoidRootPart
        end
        
        if not bg then
            bg = Instance.new("BodyGyro")
            bg.Name = "RafigFlyBG"
            bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
            bg.P = 15000
            bg.Parent = humanoidRootPart
        end
        
        bg.CFrame = camera.CFrame
        
        local moveDir = Vector3.new(0, 0, 0)
        if UserInputService:IsKeyDown(Enum.KeyCode.W) then
            moveDir = moveDir + (camera.CFrame.LookVector)
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.S) then
            moveDir = moveDir - (camera.CFrame.LookVector)
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.A) then
            moveDir = moveDir - (camera.CFrame.RightVector)
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.D) then
            moveDir = moveDir + (camera.CFrame.RightVector)
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.Space) then
            moveDir = moveDir + Vector3.new(0, 1, 0)
        end
        if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
            moveDir = moveDir - Vector3.new(0, 1, 0)
        end
        
        bv.Velocity = moveDir * speed
    end
end)

Features & Information

RafiqHy 2 Hub 🚀 A simple and convenient script hub designed for smooth movement and character control Controls:F — Toggle flight mode (Fly). N — Toggle passing through walls (Noclip). L / K — Adjust movement speed. Created by RafikHY2
#fly

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts