Version / Update: v1.0.0
- Download / Script Link
- local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local flying = false
local speed = 50
local bv, bg
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
-- UI
local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
local flyButton = Instance.new("TextButton")
flyButton.Size = UDim2.new(0, 120, 0, 50)
flyButton.Position = UDim2.new(1, -140, 0.5, -25) -- dreapta
flyButton.Text = "FLY: OFF"
flyButton.BackgroundColor3 = Color3.fromRGB(30,30,30)
flyButton.TextColor3 = Color3.new(1,1,1)
flyButton.Parent = screenGui
function startFly()
flying = true
bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(1,1,1)*100000
bv.Parent = hrp
bg = Instance.new("BodyGyro")
bg.MaxTorque = Vector3.new(1,1,1)*100000
bg.Parent = hrp
flyButton.Text = "FLY: ON"
end
function stopFly()
flying = false
if bv then bv:Destroy() end
if bg then bg:Destroy() end
flyButton.Text = "FLY: OFF"
end
-- CLICK PE BUTON
flyButton.MouseButton1Click:Connect(function()
if flying then
stopFly()
else
startFly()
end
end)
-- OPTIONAL: pastrezi si tasta F
UIS.InputBegan:Connect(function(input, gp)
if gp then return end
if input.KeyCode == Enum.KeyCode.F then
if flying then stopFly() else startFly() end
end
end)
RS.RenderStepped:Connect(function()
if not flying then return end
local cam = workspace.CurrentCamera
local dir = Vector3.new()
if UIS:IsKeyDown(Enum.KeyCode.W) then dir += cam.CFrame.LookVector end
if UIS:IsKeyDown(Enum.KeyCode.S) then dir -= cam.CFrame.LookVector end
if UIS:IsKeyDown(Enum.KeyCode.A) then dir -= cam.CFrame.RightVector end
if UIS:IsKeyDown(Enum.KeyCode.D) then dir += cam.CFrame.RightVector end
if UIS:IsKeyDown(Enum.KeyCode.Space) then dir += Vector3.new(0,1,0) end
if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then dir -= Vector3.new(0,1,0) end
if bv then
bv.Velocity = dir.Magnitude > 0 and dir.Unit * speed or Vector3.new()
end
if bg then
bg.CFrame = cam.CFrame
end
end)[ View More ]
U can fly in anygames and u can use xeno