Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views3 pages

Message

The document contains a Lua script for a Roblox GUI that includes a draggable frame with a label and a button. When the button is clicked, it toggles gravity and initiates a rotation effect for the player's character, allowing movement in response to keyboard inputs. The script also handles stopping the rotation and resetting gravity upon user actions.

Uploaded by

pato
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)
20 views3 pages

Message

The document contains a Lua script for a Roblox GUI that includes a draggable frame with a label and a button. When the button is clicked, it toggles gravity and initiates a rotation effect for the player's character, allowing movement in response to keyboard inputs. The script also handles stopping the rotation and resetting gravity upon user actions.

Uploaded by

pato
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/ 3

local gui = Instance.

new("ScreenGui")
local main = Instance.new("Frame")
local label = Instance.new("TextLabel")
local UITextSizeConstraint = Instance.new("UITextSizeConstraint")
local button = Instance.new("TextButton")
local UITextSizeConstraint_2 = Instance.new("UITextSizeConstraint")

gui.Name = "gui"
gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

main.Name = "main"
main.Parent = gui
main.BackgroundColor3 = Color3.fromRGB(72, 72, 72)
main.BorderColor3 = Color3.fromRGB(0, 0, 0)
main.BorderSizePixel = 0
main.Position = UDim2.new(0.196095973, 0, 0.556803584, 0)
main.Size = UDim2.new(0.178187668, 0, 0.13960205, 0)
main.Active = true
main.Draggable = true

label.Name = "label"
label.Parent = main
label.BackgroundColor3 = Color3.fromRGB(108, 108, 108)
label.BorderColor3 = Color3.fromRGB(0, 0, 0)
label.BorderSizePixel = 0
label.Size = UDim2.new(1, 0, 0.294736832, 0)
label.Font = Enum.Font.Gotham
label.Text = "The Drone"
label.TextColor3 = Color3.fromRGB(255, 255, 255)
label.TextScaled = true
label.TextSize = 29.000
label.TextWrapped = true

UITextSizeConstraint.Parent = label
UITextSizeConstraint.MaxTextSize = 29

button.Name = "button"
button.Parent = main
button.BackgroundColor3 = Color3.fromRGB(108, 108, 108)
button.BorderColor3 = Color3.fromRGB(0, 0, 0)
button.BorderSizePixel = 0
button.Position = UDim2.new(0.0526315793, 0, 0.438756049, 0)
button.Size = UDim2.new(0.894736826, 0, 0.431578934, 0)
button.Font = Enum.Font.Gotham
button.Text = "Click"
button.TextColor3 = Color3.fromRGB(255, 255, 255)
button.TextSize = 24.000
button.TextScaled = true
button.TextWrapped = true

UITextSizeConstraint_2.Parent = button
UITextSizeConstraint_2.MaxTextSize = 31

-- Scripts:

local plr = game.Players.LocalPlayer


local normalGravity = workspace.Gravity
local rotating = false
local rotationSpeed = math.pi / 4 -- Rotation speed (adjust as needed)
local input = {forward = 0, right = 0}
local speed = 10 -- Increased speed

local function MUBRZ_fake_script() -- button.script


local script = Instance.new('LocalScript', button)

local function onButtonClick()


if not rotating then
workspace.Gravity = 0
rotating = true

local humanoid = plr.Character:FindFirstChildWhichIsA("Humanoid")


if humanoid then
humanoid.Sit = true
for _, v in ipairs(humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
end

-- Start rotation
game:GetService("RunService").Heartbeat:Connect(function()
if rotating and humanoid and humanoid.RootPart then
humanoid.RootPart.CFrame = humanoid.RootPart.CFrame *
CFrame.Angles(0, rotationSpeed * tick(), 0)
end
end)
else
-- Stop rotation and reset gravity
workspace.Gravity = normalGravity
rotating = false
game:GetService("RunService").Heartbeat:Disconnect()
end
end

script.Parent.MouseButton1Click:Connect(onButtonClick)

game:GetService("UserInputService").JumpRequest:Connect(function()
workspace.Gravity = normalGravity
rotating = false
game:GetService("RunService").Heartbeat:Disconnect()
end)

-- Handle input for movement


local function onInputBegan(inputObject, gameProcessed)
if gameProcessed then return end
if inputObject.KeyCode == Enum.KeyCode.W then
input.forward = 1
elseif inputObject.KeyCode == Enum.KeyCode.S then
input.forward = -1
elseif inputObject.KeyCode == Enum.KeyCode.A then
input.right = -1
elseif inputObject.KeyCode == Enum.KeyCode.D then
input.right = 1
end
end

local function onInputEnded(inputObject, gameProcessed)


if gameProcessed then return end
if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode ==
Enum.KeyCode.S then
input.forward = 0
elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode ==
Enum.KeyCode.D then
input.right = 0
end
end

game:GetService("UserInputService").InputBegan:Connect(onInputBegan)
game:GetService("UserInputService").InputEnded:Connect(onInputEnded)

-- Movement logic
game:GetService("RunService").Heartbeat:Connect(function()
if rotating then
local moveVector = Vector3.new(input.right, 0, input.forward)
local delta = moveVector * speed *
game:GetService("RunService").Heartbeat:Wait()
local humanoid = plr.Character:FindFirstChildWhichIsA("Humanoid")
if humanoid and humanoid.RootPart then
humanoid.RootPart.CFrame = humanoid.RootPart.CFrame + delta
end
end
end)
end
coroutine.wrap(MUBRZ_fake_script)()

You might also like