0% found this document useful (0 votes)
12 views2 pages

BQ 3 XA8 LM

This document outlines a script for creating a GUI in Roblox that allows players to toggle flying and adjust their speed. It includes a menu with buttons for flying and speed control, and uses BodyVelocity to manage the player's movement. The script also handles user input for directional control while flying.

Uploaded by

Asian Dąb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

BQ 3 XA8 LM

This document outlines a script for creating a GUI in Roblox that allows players to toggle flying and adjust their speed. It includes a menu with buttons for flying and speed control, and uses BodyVelocity to manage the player's movement. The script also handles user input for directional control while flying.

Uploaded by

Asian Dąb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

-- Utwórz ScreenGui

local gui = Instance.new("ScreenGui")


gui.Parent = game.CoreGui

-- Utwórz ramkę menu


local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 200, 0, 150)
frame.Position = UDim2.new(0, 100, 0, 100)
frame.BackgroundColor3 = Color3.fromRGB(30,30,30)
frame.Parent = gui

-- Utwórz przycisk latania


local flyButton = Instance.new("TextButton")
flyButton.Size = UDim2.new(1, 0, 0, 50)
flyButton.Position = UDim2.new(0, 0, 0, 0)
flyButton.Text = "Toggle Fly"
flyButton.BackgroundColor3 = Color3.fromRGB(70,70,70)
flyButton.TextColor3 = Color3.new(1,1,1)
flyButton.Parent = frame

-- Utwórz slider prędkości (prosty przycisk na zmianę)


local speedButton = Instance.new("TextButton")
speedButton.Size = UDim2.new(1, 0, 0, 50)
speedButton.Position = UDim2.new(0, 0, 0, 60)
speedButton.Text = "Speed: 50"
speedButton.BackgroundColor3 = Color3.fromRGB(70,70,70)
speedButton.TextColor3 = Color3.new(1,1,1)
speedButton.Parent = frame

-- Funkcja latania
local flying = false
local speed = 50
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("HumanoidRootPart")

local bv = nil

flyButton.MouseButton1Click:Connect(function()
flying = not flying
if flying then
bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(1,1,1) * 1e9
bv.Velocity = Vector3.new(0,0,0)
bv.Parent = hum
else
if bv then bv:Destroy() end
end
end)

speedButton.MouseButton1Click:Connect(function()
speed = speed + 10
if speed > 200 then speed = 10 end
speedButton.Text = "Speed: " .. tostring(speed)
end)

-- Sterowanie
game:GetService("RunService").RenderStepped:Connect(function()
if flying and bv then
local dir = Vector3.new()
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.W) then
dir = dir + workspace.CurrentCamera.CFrame.LookVector
end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.S) then
dir = dir - workspace.CurrentCamera.CFrame.LookVector
end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.A) then
dir = dir - workspace.CurrentCamera.CFrame.RightVector
end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.D) then
dir = dir + workspace.CurrentCamera.CFrame.RightVector
end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.Space) then
dir = dir + Vector3.new(0,1,0)
end
if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftControl)
then
dir = dir - Vector3.new(0,1,0)
end
bv.Velocity = dir.Unit * speed
end
end)

You might also like