
KeylessUniversal

-- FreeCamToggleGui.local.lua
-- This LocalScript creates a draggable, closeable GUI with a toggle button
-- to switch between free cam mode and character-follow cam mode.
-- The GUI is styled according to the Default Design Guidelines.
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local StarterGui = game:GetService("StarterGui")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
local mouse = player:GetMouse()
-- State variables
local freeCamEnabled = false
-- GUI setup
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FreeCamToggleGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")
screenGui.IgnoreGuiInset = true
screenGui.Enabled = true
-- Main frame container
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.new(0, 280, 0, 140)
mainFrame.Position = UDim2.new(0.5, -140, 0.5, -70)
mainFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
mainFrame.BackgroundTransparency = 0
mainFrame.BorderSizePixel = 0
mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
mainFrame.Parent = screenGui
mainFrame.ClipsDescendants = true
-- Rounded corners for mainFrame
local uicorner = Instance.new("UICorner")
uicorner.CornerRadius = UDim.new(0, 12)
uicorner.Parent = mainFrame
-- Shadow effect using UIStroke
local uistroke = Instance.new("UIStroke")
uistroke.Thickness = 1
uistroke.Color = Color3.fromRGB(0,0,0)
uistroke.Transparency = 0.9
uistroke.Parent = mainFrame
-- Title label
local titleLabel = Instance.new("TextLabel")
titleLabel.Name = "TitleLabel"
titleLabel.Text = "Camera Mode"
titleLabel.Font = Enum.Font.GothamSemibold
titleLabel.TextSize = 24
titleLabel.TextColor3 = Color3.fromRGB(17, 24, 39) -- #111827
titleLabel.BackgroundTransparency = 1
titleLabel.Size = UDim2.new(1, -40, 0, 32)
titleLabel.Position = UDim2.new(0, 20, 0, 12)
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Parent = mainFrame
-- Close button
local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Size = UDim2.new(0, 28, 0, 28)
closeButton.Position = UDim2.new(1, -36, 0, 8)
closeButton.BackgroundColor3 = Color3.fromRGB(230, 230, 230)
closeButton.TextColor3 = Color3.fromRGB(80, 80, 80)
closeButton.Font = Enum.Font.GothamBold
closeButton.TextSize = 18
closeButton.Text = "✕"
closeButton.AutoButtonColor = true
closeButton.AnchorPoint = Vector2.new(0, 0)
closeButton.Parent = mainFrame
local closeUICorner = Instance.new("UICorner")
closeUICorner.CornerRadius = UDim.new(0, 8)
closeUICorner.Parent = closeButton
-- Functionality for close button: hide GUI and show toggle button
closeButton.MouseButton1Click:Connect(function()
screenGui.Enabled = false
toggleButton.Visible = true
end)
-- Free Cam toggle button
local freeCamToggle = Instance.new("TextButton")
freeCamToggle.Name = "FreeCamToggle"
freeCamToggle.Size = UDim2.new(1, -40, 0, 48)
freeCamToggle.Position = UDim2.new(0, 20, 0, 56)
freeCamToggle.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
freeCamToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
freeCamToggle.Font = Enum.Font.GothamSemibold
freeCamToggle.TextSize = 18
freeCamToggle.Text = "Enable Free Cam"
freeCamToggle.AutoButtonColor = true
freeCamToggle.Parent = mainFrame
local toggleUICorner = Instance.new("UICorner")
toggleUICorner.CornerRadius = UDim.new(0, 12)
toggleUICorner.Parent = freeCamToggle
-- Draggable functionality for mainFrame
local draggingMain = false
local dragInput, dragStart, startPos
mainFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
draggingMain = true
dragInput = input
dragStart = input.Position
startPos = mainFrame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
draggingMain = false
end
end)
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and draggingMain then
local delta = input.Position - dragStart
mainFrame.Position = UDim2.new(
startPos.X.Scale,
startPos.X.Offset + delta.X,
startPos.Y.Scale,
startPos.Y.Offset + delta.Y
)
end
end)
-- Free cam control variables
local connection
local function enableFreeCam()
if connection then
connection:Disconnect()
connection = nil
end
camera.CameraType = Enum.CameraType.Scriptable
freeCamEnabled = true
local camCFrame = camera.CFrame
local moveVector = Vector3.new()
local speed = 1.5
connection = RunService.RenderStepped:Connect(function(deltaTime)
local moveDirection = Vector3.new()
-- WASD or arrow keys for PC
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
moveDirection = moveDirection + Vector3.new(0, 0, -1)
end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then
moveDirection = moveDirection + Vector3.new(0, 0, 1)
end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then
moveDirection = moveDirection + Vector3.new(-1, 0, 0)
end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then
moveDirection = moveDirection + Vector3.new(1, 0, 0)
end
if UserInputService:IsKeyDown(Enum.KeyCode.Space) then
moveDirection = moveDirection + Vector3.new(0, 1, 0)
end
if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
moveDirection = moveDirection + Vector3.new(0, -1, 0)
end
if moveDirection.Magnitude > 0 then
moveDirection = moveDirection.Unit
camCFrame = camCFrame + (camCFrame:VectorToWorldSpace(moveDirection) * speed)
end
camera.CFrame = camCFrame
end)
end
local function disableFreeCam()
if connection then
connection:Disconnect()
connection = nil
end
camera.CameraType = Enum.CameraType.Custom
freeCamEnabled = false
end
freeCamToggle.MouseButton1Click:Connect(function()
if freeCamEnabled then
disableFreeCam()
freeCamToggle.Text = "Enable Free Cam"
else
enableFreeCam()
freeCamToggle.Text = "Disable Free Cam"
end
end)
-- Floating toggle button to reopen GUI on mobile (and desktop)
local toggleButton = Instance.new("TextButton")
toggleButton.Name = "ToggleButton"
toggleButton.Size = UDim2.new(0, 48, 0, 48)
toggleButton.Position = UDim2.new(1, -60, 1, -60) -- bottom-right with margin
toggleButton.AnchorPoint = Vector2.new(1, 1)
toggleButton.BackgroundColor3 = Color3.fromRGB(240, 240, 240)
toggleButton.BackgroundTransparency = 0
toggleButton.TextColor3 = Color3.fromRGB(55, 65, 81) -- #374151 neutral gray
toggleButton.Font = Enum.Font.GothamSemibold
toggleButton.TextSize = 28
toggleButton.Text = "≡" -- hamburger menu icon
toggleButton.AutoButtonColor = true
toggleButton.Parent = screenGui
toggleButton.ZIndex = 10
local toggleUICorner = Instance.new("UICorner")
toggleUICorner.CornerRadius = UDim.new(1, 0) -- circular button
toggleUICorner.Parent = toggleButton
-- Initially toggleButton visible only if GUI hidden
toggleButton.Visible = false
toggleButton.MouseButton1Click:Connect(function()
screenGui.Enabled = true
toggleButton.Visible = false
end)
-- Optional: Also support keyboard toggle ("F") for desktop convenience
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.F then
local guiWasEnabled = screenGui.Enabled
screenGui.Enabled = not guiWasEnabled
toggleButton.Visible = guiWasEnabled -- show toggle when GUI hidden
end
end)



In Showcase ✅
credits to ai
AI Script
Yeah, its ai My voice cracked after asking ai to make me gui buttons BUT ITS ALWAYS BROKEN so here it is... Still broken💀
my guy ts isnt that hard if you make one yourself your prob gonna make one alot better than this one and for gui use reyfield
Yeah i tried making my own gui script but its ALWAYS failure so i forced myself to use ai
@Looey Learn from your failure