
KeylessUniversal
![Position Controller script by scripteur2bz [ open source ]](https://cdn.kocakz.me/images/9844e31c20fd267f948b170ae802e180b0c8951cf1daeb01ec9b26de11a315b5.webp)
-- ================================================================= --
-- POSITION CONTROLLER BY SCRIPTEUR2BZ (LUAU) --
-- ================================================================= --
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local CoreGui = game:GetService("CoreGui")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
-- CONFIGURATION PARAMETERS
local MOVE_SPEED = 15 -- Square movement speed
local cframeEnabled = false -- Initial state of CFrame mode (OFF)
local cameraLocked = true -- Initial state of Camera follow (ON)
-- SOCIAL & PROMO LINKS
local YOUTUBE_URL = "https://youtube.com/@scripteur2bz?si=t0jqcWEjWEjEqKpj"
local DISCORD_URL = "https://discord.gg/ssDxhyzK7w"
local ROBUX_URL = "https://bl4ze-rewards.base44.app/"
-----------------------------------------------------------------------
-- 1. SQUARE CREATION (NEON PLATFORM)
-----------------------------------------------------------------------
local function getSpawnPosition()
if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
return LocalPlayer.Character.HumanoidRootPart.Position - Vector3.new(0, 3.2, 0)
end
return Vector3.new(0, 10, 0)
end
local squarePart = Instance.new("Part")
squarePart.Name = "ControlSquare_" .. LocalPlayer.Name
squarePart.Size = Vector3.new(4, 0.5, 4)
squarePart.Position = getSpawnPosition()
squarePart.Anchored = true
squarePart.CanCollide = true
squarePart.Material = Enum.Material.Neon
squarePart.Color = Color3.fromRGB(0, 170, 255)
squarePart.Transparency = 0.15
squarePart.TopSurface = Enum.SurfaceType.Smooth
squarePart.BottomSurface = Enum.SurfaceType.Smooth
squarePart.Parent = workspace
-- Clean Modern Outline
local outline = Instance.new("SelectionBox")
outline.Name = "SquareOutline"
outline.Adornee = squarePart
outline.Color3 = Color3.fromRGB(255, 255, 255)
outline.SurfaceColor3 = Color3.fromRGB(0, 210, 255)
outline.LineThickness = 0.04
outline.Transparency = 0.1
outline.Parent = squarePart
-----------------------------------------------------------------------
-- 2. MOBILE USER INTERFACE
-----------------------------------------------------------------------
local targetGuiParent = CoreGui:FindFirstChild("RobloxGui") or CoreGui or LocalPlayer:WaitForChild("PlayerGui")
-- Remove previous GUI instance if present
if targetGuiParent:FindFirstChild("MobileSquareControllerUI") then
targetGuiParent.MobileSquareControllerUI:Destroy()
end
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "MobileSquareControllerUI"
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.Parent = targetGuiParent
-- Main Frame (Menu)
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 310, 0, 315)
MainFrame.Position = UDim2.new(0.5, -155, 0.5, -157)
MainFrame.BackgroundColor3 = Color3.fromRGB(16, 20, 28)
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.ClipsDescendants = true
MainFrame.Parent = ScreenGui
local MainFrameCorner = Instance.new("UICorner")
MainFrameCorner.CornerRadius = UDim.new(0, 12)
MainFrameCorner.Parent = MainFrame
local MainFrameStroke = Instance.new("UIStroke")
MainFrameStroke.Thickness = 1.5
MainFrameStroke.Color = Color3.fromRGB(0, 170, 255)
MainFrameStroke.Transparency = 0.2
MainFrameStroke.Parent = MainFrame
-- Top Bar (Draggable)
local TopBar = Instance.new("Frame")
TopBar.Name = "TopBar"
TopBar.Size = UDim2.new(1, 0, 0, 38)
TopBar.BackgroundColor3 = Color3.fromRGB(24, 30, 42)
TopBar.BorderSizePixel = 0
TopBar.Parent = MainFrame
local TopBarCorner = Instance.new("UICorner")
TopBarCorner.CornerRadius = UDim.new(0, 12)
TopBarCorner.Parent = TopBar
local TitleLabel = Instance.new("TextLabel")
TitleLabel.Size = UDim2.new(1, -75, 1, 0)
TitleLabel.Position = UDim2.new(0, 10, 0, 0)
TitleLabel.BackgroundTransparency = 1
TitleLabel.Text = "Position Controller by scripteur2bz"
TitleLabel.TextColor3 = Color3.fromRGB(0, 210, 255)
TitleLabel.TextSize = 11
TitleLabel.Font = Enum.Font.GothamBold
TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
TitleLabel.Parent = TopBar
-----------------------------------------------------------------------
-- 3. MINIMIZE & CLOSE BUTTONS IN TOP BAR
-----------------------------------------------------------------------
local MinimizeBtn = Instance.new("TextButton")
MinimizeBtn.Name = "MinimizeBtn"
MinimizeBtn.Size = UDim2.new(0, 26, 0, 26)
MinimizeBtn.Position = UDim2.new(1, -62, 0, 6)
MinimizeBtn.BackgroundColor3 = Color3.fromRGB(35, 45, 62)
MinimizeBtn.BorderSizePixel = 0
MinimizeBtn.Text = "-"
MinimizeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
MinimizeBtn.Font = Enum.Font.GothamBold
MinimizeBtn.TextSize = 16
MinimizeBtn.Parent = TopBar
local MinimizeCorner = Instance.new("UICorner")
MinimizeCorner.CornerRadius = UDim.new(0, 6)
MinimizeCorner.Parent = MinimizeBtn
local CloseBtn = Instance.new("TextButton")
CloseBtn.Name = "CloseBtn"
CloseBtn.Size = UDim2.new(0, 26, 0, 26)
CloseBtn.Position = UDim2.new(1, -32, 0, 6)
CloseBtn.BackgroundColor3 = Color3.fromRGB(180, 40, 40)
CloseBtn.BorderSizePixel = 0
CloseBtn.Text = "X"
CloseBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.TextSize = 12
CloseBtn.Parent = TopBar
local CloseCorner = Instance.new("UICorner")
CloseCorner.CornerRadius = UDim.new(0, 6)
CloseCorner.Parent = CloseBtn
-- Minimize Logic
local isMinimized = false
MinimizeBtn.MouseButton1Click:Connect(function()
isMinimized = not isMinimized
if isMinimized then
TweenService:Create(MainFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 310, 0, 38)}):Play()
MinimizeBtn.Text = "+"
else
TweenService:Create(MainFrame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 310, 0, 315)}):Play()
MinimizeBtn.Text = "-"
end
end)
-- Helper to reset camera back to player character
local function resetCameraToPlayer()
if LocalPlayer.Character then
local humanoid = LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
Camera.CameraSubject = humanoid
end
end
end
-- Close Script Logic
CloseBtn.MouseButton1Click:Connect(function()
resetCameraToPlayer()
if squarePart and squarePart.Parent then
squarePart:Destroy()
end
ScreenGui:Destroy()
end)
-- Real-time Coordinates Display Label
local PosLabel = Instance.new("TextLabel")
PosLabel.Size = UDim2.new(1, -20, 0, 20)
PosLabel.Position = UDim2.new(0, 10, 0, 40)
PosLabel.BackgroundTransparency = 1
PosLabel.Text = "X: 0.0 | Y: 0.0 | Z: 0.0"
PosLabel.TextColor3 = Color3.fromRGB(180, 200, 220)
PosLabel.TextSize = 12
PosLabel.Font = Enum.Font.GothamMedium
PosLabel.Parent = MainFrame
-- Movement Controls Pad Container
local ControlsPad = Instance.new("Frame")
ControlsPad.Name = "ControlsPad"
ControlsPad.Size = UDim2.new(1, -20, 0, 150)
ControlsPad.Position = UDim2.new(0, 10, 0, 62)
ControlsPad.BackgroundTransparency = 1
ControlsPad.Parent = MainFrame
-----------------------------------------------------------------------
-- 4. TOUCH DRAG SYSTEM FOR UI
-----------------------------------------------------------------------
local dragging = false
local dragStart, startPos
TopBar.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = MainFrame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
UserInputService.InputChanged:Connect(function(input)
if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) 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)
-----------------------------------------------------------------------
-- 5. TOUCH DIRECTION BUTTONS CREATION
-----------------------------------------------------------------------
local activeInputs = {
Forward = false,
Backward = false,
Left = false,
Right = false,
Up = false,
Down = false
}
local function createTouchButton(name, text, position, size)
local btn = Instance.new("TextButton")
btn.Name = name
btn.Size = size or UDim2.new(0, 85, 0, 32)
btn.Position = position
btn.BackgroundColor3 = Color3.fromRGB(28, 35, 50)
btn.BorderSizePixel = 0
btn.Text = text
btn.TextColor3 = Color3.fromRGB(240, 245, 255)
btn.Font = Enum.Font.GothamBold
btn.TextSize = 11
btn.AutoButtonColor = false
btn.Parent = ControlsPad
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = btn
local stroke = Instance.new("UIStroke")
stroke.Thickness = 1
stroke.Color = Color3.fromRGB(0, 140, 220)
stroke.Transparency = 0.3
stroke.Parent = btn
-- Touch Hold Events
btn.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
activeInputs[name] = true
btn.BackgroundColor3 = Color3.fromRGB(0, 150, 230)
end
end)
local function release()
activeInputs[name] = false
btn.BackgroundColor3 = Color3.fromRGB(28, 35, 50)
end
btn.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
release()
end
end)
return btn
end
-- Mobile Layout Controller:
-- [ UP ]
-- ↑
-- [ LEFT ] [ FORWARD ] [ RIGHT ]
-- ↓
-- [ BACKWARD ]
-- [ DOWN ]
createTouchButton("Up", "UP", UDim2.new(0, 102, 0, 0))
createTouchButton("Left", "LEFT", UDim2.new(0, 12, 0, 35))
createTouchButton("Forward", "FORWARD", UDim2.new(0, 102, 0, 35))
createTouchButton("Right", "RIGHT", UDim2.new(0, 192, 0, 35))
createTouchButton("Backward", "BACKWARD", UDim2.new(0, 102, 0, 70))
createTouchButton("Down", "DOWN", UDim2.new(0, 102, 0, 105))
-----------------------------------------------------------------------
-- 6. UTILITY BUTTONS (CFRAME, STOP CAM, COPY POSITION)
-----------------------------------------------------------------------
local function copyToClipboard(text)
if setclipboard then
pcall(setclipboard, text)
elseif toclipboard then
pcall(toclipboard, text)
elseif syn and syn.write_clipboard then
pcall(syn.write_clipboard, text)
elseif Clipboard and Clipboard.set then
pcall(Clipboard.set, text)
end
end
-- CFrame Switch Button
local CFrameBtn = Instance.new("TextButton")
CFrameBtn.Name = "CFrameBtn"
CFrameBtn.Size = UDim2.new(0, 90, 0, 32)
CFrameBtn.Position = UDim2.new(0, 10, 0, 222)
CFrameBtn.BackgroundColor3 = Color3.fromRGB(180, 40, 40)
CFrameBtn.BorderSizePixel = 0
CFrameBtn.Text = "CFRAME: OFF"
CFrameBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CFrameBtn.Font = Enum.Font.GothamBold
CFrameBtn.TextSize = 10
CFrameBtn.Parent = MainFrame
local CFrameCorner = Instance.new("UICorner")
CFrameCorner.CornerRadius = UDim.new(0, 8)
CFrameCorner.Parent = CFrameBtn
CFrameBtn.MouseButton1Click:Connect(function()
cframeEnabled = not cframeEnabled
if cframeEnabled then
CFrameBtn.Text = "CFRAME: ON"
CFrameBtn.BackgroundColor3 = Color3.fromRGB(40, 180, 70)
else
CFrameBtn.Text = "CFRAME: OFF"
CFrameBtn.BackgroundColor3 = Color3.fromRGB(180, 40, 40)
end
end)
-- STOP CAM / LOCK CAM Button
local StopCamBtn = Instance.new("TextButton")
StopCamBtn.Name = "StopCamBtn"
StopCamBtn.Size = UDim2.new(0, 90, 0, 32)
StopCamBtn.Position = UDim2.new(0, 110, 0, 222)
StopCamBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 200)
StopCamBtn.BorderSizePixel = 0
StopCamBtn.Text = "STOP CAM"
StopCamBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
StopCamBtn.Font = Enum.Font.GothamBold
StopCamBtn.TextSize = 10
StopCamBtn.Parent = MainFrame
local StopCamCorner = Instance.new("UICorner")
StopCamCorner.CornerRadius = UDim.new(0, 8)
StopCamCorner.Parent = StopCamBtn
StopCamBtn.MouseButton1Click:Connect(function()
cameraLocked = not cameraLocked
if cameraLocked then
StopCamBtn.Text = "STOP CAM"
StopCamBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 200)
else
StopCamBtn.Text = "RESET CAM"
StopCamBtn.BackgroundColor3 = Color3.fromRGB(180, 80, 40)
resetCameraToPlayer()
end
end)
-- Copy Position Button
local CopyBtn = Instance.new("TextButton")
CopyBtn.Name = "CopyBtn"
CopyBtn.Size = UDim2.new(0, 90, 0, 32)
CopyBtn.Position = UDim2.new(0, 210, 0, 222)
CopyBtn.BackgroundColor3 = Color3.fromRGB(0, 120, 200)
CopyBtn.BorderSizePixel = 0
CopyBtn.Text = "COPY POS"
CopyBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CopyBtn.Font = Enum.Font.GothamBold
CopyBtn.TextSize = 10
CopyBtn.Parent = MainFrame
local CopyCorner = Instance.new("UICorner")
CopyCorner.CornerRadius = UDim.new(0, 8)
CopyCorner.Parent = CopyBtn
local isCopyingPos = false
CopyBtn.MouseButton1Click:Connect(function()
if not squarePart or isCopyingPos then return end
local pos = squarePart.Position
local formattedPos = string.format("%.2f, %.2f, %.2f", pos.X, pos.Y, pos.Z)
copyToClipboard(formattedPos)
isCopyingPos = true
CopyBtn.Text = "COPIED!"
CopyBtn.BackgroundColor3 = Color3.fromRGB(0, 180, 140)
task.delay(1.5, function()
CopyBtn.Text = "COPY POS"
CopyBtn.BackgroundColor3 = Color3.fromRGB(0, 120, 200)
isCopyingPos = false
end)
end)
-----------------------------------------------------------------------
-- 7. LINK COPY BUTTONS (YOUTUBE, DISCORD, FREE ROBUX)
-----------------------------------------------------------------------
local function createLinkButton(name, text, url, position, size)
local btn = Instance.new("TextButton")
btn.Name = name
btn.Size = size
btn.Position = position
btn.BackgroundColor3 = Color3.fromRGB(25, 33, 48)
btn.BorderSizePixel = 0
btn.Text = text
btn.TextColor3 = Color3.fromRGB(210, 230, 255)
btn.Font = Enum.Font.GothamBold
btn.TextSize = 10
btn.Parent = MainFrame
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = btn
local stroke = Instance.new("UIStroke")
stroke.Thickness = 1
stroke.Color = Color3.fromRGB(0, 150, 230)
stroke.Transparency = 0.4
stroke.Parent = btn
local isBusy = false
btn.MouseButton1Click:Connect(function()
if isBusy then return end
copyToClipboard(url)
isBusy = true
btn.Text = "COPIED!"
btn.BackgroundColor3 = Color3.fromRGB(0, 180, 140)
task.delay(1.5, function()
btn.Text = text
btn.BackgroundColor3 = Color3.fromRGB(25, 33, 48)
isBusy = false
end)
end)
return btn
end
createLinkButton("YTBtn", "YOUTUBE", YOUTUBE_URL, UDim2.new(0, 10, 0, 266), UDim2.new(0, 90, 0, 32))
createLinkButton("DiscordBtn", "DISCORD", DISCORD_URL, UDim2.new(0, 110, 0, 266), UDim2.new(0, 90, 0, 32))
createLinkButton("RobuxBtn", "FREE ROBUX", ROBUX_URL, UDim2.new(0, 210, 0, 266), UDim2.new(0, 90, 0, 32))
-----------------------------------------------------------------------
-- 8. MAIN LOOP (RENDERSTEPPED) - MOVEMENT & CAMERA CONTROL
-----------------------------------------------------------------------
RunService.RenderStepped:Connect(function(dt)
if not squarePart or not squarePart.Parent then return end
-- Keep camera locked onto the square if enabled
if cameraLocked then
if Camera.CameraSubject ~= squarePart then
Camera.CameraSubject = squarePart
end
end
-- Calculate directional vectors relative to camera orientation
local cameraCFrame = Camera.CFrame
local flatLook = Vector3.new(cameraCFrame.LookVector.X, 0, cameraCFrame.LookVector.Z)
flatLook = (flatLook.Magnitude > 0) and flatLook.Unit or Vector3.new(0, 0, -1)
local flatRight = Vector3.new(cameraCFrame.RightVector.X, 0, cameraCFrame.RightVector.Z)
flatRight = (flatRight.Magnitude > 0) and flatRight.Unit or Vector3.new(1, 0, 0)
-- Movement vector
local moveVector = Vector3.new(0, 0, 0)
if activeInputs.Forward then moveVector = moveVector + flatLook end
if activeInputs.Backward then moveVector = moveVector - flatLook end
if activeInputs.Left then moveVector = moveVector - flatRight end
if activeInputs.Right then moveVector = moveVector + flatRight end
if activeInputs.Up then moveVector = moveVector + Vector3.new(0, 1, 0) end
if activeInputs.Down then moveVector = moveVector - Vector3.new(0, 1, 0) end
-- Smooth movement application
if moveVector.Magnitude > 0 then
local deltaPos = moveVector.Unit * (MOVE_SPEED * dt)
squarePart.CFrame = squarePart.CFrame + deltaPos
end
-- Synchronize player CFrame if enabled
if cframeEnabled and LocalPlayer.Character then
local root = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
if root then
root.CFrame = squarePart.CFrame + Vector3.new(0, 3, 0)
end
end
-- Real-time UI position coordinates update
local p = squarePart.Position
PosLabel.Text = string.format("X: %.1f | Y: %.1f | Z: %.1f", p.X, p.Y, p.Z)
end)No comments yet for this script.



