
Key RequiredUniversal

local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()
local Window = Rayfield:CreateWindow({
Name = "Fly Hub | Rayfield",
LoadingTitle = "Rayfield Fly Script",
LoadingSubtitle = "by Fly Hub",
ConfigurationSaving = {
Enabled = false
},
Discord = {
Enabled = false
},
KeySystem = false
})
-- Variables
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local flying = false
local speed = 50
local walkSpeedValue = 16
local bodyVelocity, bodyGyro
-- Fly Functions
local function startFlying()
local character = player.Character
if not character then return end
local root = character:FindFirstChild("HumanoidRootPart")
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not root or not humanoid then return end
humanoid.PlatformStand = true
bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(1, 1, 1) * 100000
bodyVelocity.Velocity = Vector3.zero
bodyVelocity.Parent = root
bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(1, 1, 1) * 100000
bodyGyro.CFrame = root.CFrame
bodyGyro.Parent = root
flying = true
end
local function stopFlying()
flying = false
if bodyVelocity then bodyVelocity:Destroy() end
if bodyGyro then bodyGyro:Destroy() end
local character = player.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.PlatformStand = false
end
end
end
-- WalkSpeed Loop (Keeps WalkSpeed set continuously)
RunService.RenderStepped:Connect(function()
local character = player.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid and not flying then
humanoid.WalkSpeed = walkSpeedValue
end
end
end)
-- RenderStepped Fly Movement Loop (Works with WASD & Mobile Joystick)
RunService.RenderStepped:Connect(function()
if flying and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
local root = player.Character.HumanoidRootPart
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
bodyGyro.CFrame = camera.CFrame
local moveDir = humanoid and humanoid.MoveDirection or Vector3.zero
if moveDir.Magnitude > 0 then
bodyVelocity.Velocity = camera.CFrame.LookVector * (moveDir.Magnitude * speed)
else
bodyVelocity.Velocity = Vector3.zero
end
end
end)
-- Rayfield Tab & Elements
local MainTab = Window:CreateTab("Main Controls", 4483362458)
local FlyToggle = MainTab:CreateToggle({
Name = "Enable Fly",
CurrentValue = false,
Flag = "FlyToggle",
Callback = function(Value)
if Value then
startFlying()
else
stopFlying()
end
end,
})
local SpeedSlider = MainTab:CreateSlider({
Name = "Fly Speed",
Range = {10, 300},
Increment = 5,
Suffix = "Speed",
CurrentValue = 50,
Flag = "SpeedSlider",
Callback = function(Value)
speed = Value
end,
})
local WalkSpeedSlider = MainTab:CreateSlider({
Name = "WalkSpeed",
Range = {16, 250},
Increment = 1,
Suffix = "Speed",
CurrentValue = 16,
Flag = "WalkSpeedSlider",
Callback = function(Value)
walkSpeedValue = Value
local character = player.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.WalkSpeed = Value
end
end
end,
})No comments yet for this script.



