Macro
Key RequiredUniversal

Macro

Universal ScriptCodedWithoutExecuterCodedWithoutExecuter 8.7K views 288 executesUpdated Jun 14, 2025
Unrated
00
Lua Script•356 lines (11735 chars)
-- macro testing
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Root = Character:WaitForChild("HumanoidRootPart")

local commandList = {}
global1 = false
-- Define fireproximityprompt if not already available
if not fireproximityprompt then
	function fireproximityprompt(prompt, hold)
		if prompt and prompt:IsA("ProximityPrompt") then
			if hold then
				prompt:InputHoldBegin()
			else
				prompt:InputHoldEnd()
			end
		end
	end
end

local AvailableCommands = {
	["HumanoidMoveTo"] = {args = {"X", "Y", "Z"}, example = "HumanoidMoveTo(5, 0, 5)"},
	["Loop"] = {args = {}, example = "Loop()"},
	["Wait"] = {args = {"Time"}, example = "Wait(1.5)"},
	["WaitUntillDone"] = {args = {}, example = "WaitUntillDone()"},
	["TweenTo"] = {args = {"Speed", "X", "Y", "Z"}, example = "TweenTo(3, 5, 0, 5)"},
	["Teleport"] = {args = {"X", "Y", "Z"}, example = "Teleport(0, 10, 0)"}
	--["LookAt"] = {args = {"X", "Y", "Z"}, example = "LookAt(0, 0, 0)"}, -- commented out
	--["InteractProximityPrompt"] = {args = {"Time"}, example = "InteractProximityPrompt(2.5)"} -- commented out
}

local lastYieldingTask = nil

local function runCommands()
	coroutine.wrap(function()
		local i = 1
		while i <= #commandList do
			local commandStr = commandList[i]
			local commandName, argsStr = commandStr:match("([^(]+)%((.*)%)")
			local args = {}
			for arg in string.gmatch(argsStr, "[^,]+") do
				table.insert(args, tonumber(arg) or arg)
			end

			if commandName == "HumanoidMoveTo" then
				lastYieldingTask = Instance.new("BindableEvent")
				Humanoid:MoveTo(Vector3.new(unpack(args)))
				local connection
				connection = Humanoid.MoveToFinished:Connect(function(reached)
					connection:Disconnect()
					lastYieldingTask:Fire()
				end)

			elseif commandName == "TweenTo" then
				global1 = true
				lastYieldingTask = Instance.new("BindableEvent")
				local target = Vector3.new(args[2], args[3], args[4])
				local tweenInfo = TweenInfo.new((Root.Position - target).Magnitude / args[1], Enum.EasingStyle.Linear)
				local tween = TweenService:Create(Root, tweenInfo, {CFrame = CFrame.new(target)})
				tween:Play()
				tween.Completed:Connect(function()
					global1 = false
					lastYieldingTask:Fire()
				end)

			elseif commandName == "Wait" then
				task.wait(tonumber(args[1]))

			elseif commandName == "WaitUntillDone" then
				if lastYieldingTask then
					lastYieldingTask.Event:Wait()
					lastYieldingTask = nil
				end

			elseif commandName == "LookAt" then
				local target = Vector3.new(unpack(args))
				local look = CFrame.new(Root.Position, target)
				Root.CFrame = look

			elseif commandName == "InteractProximityPrompt" then
				local prompt = Root:FindFirstChildWhichIsA("ProximityPrompt", true)
				if prompt then
					fireproximityprompt(prompt)
					task.wait(tonumber(args[1]) or 1)
				end

			elseif commandName == "Loop" then
				i = 0 -- will increment to 1
			elseif commandName == "Teleport" then
				Root.CFrame = CFrame.new(Vector3.new(unpack(args)))
			end

			i += 1
		end
	end)()
end

local function showCommandDialog(commandName, onConfirm)
	local command = AvailableCommands[commandName]
	if not command then return end

	local inputDialog = Instance.new("ScreenGui", PlayerGui)
	local frame = Instance.new("Frame", inputDialog)
	frame.Size = UDim2.new(0.3, 0, 0.32, 0) -- reduced height by 20%
	frame.Position = UDim2.new(0.35, 0, 0.3, 0)
	frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)

	local inputs = {}
	for i, arg in ipairs(command.args) do
		local label = Instance.new("TextLabel", frame)
		label.Text = arg
		label.Position = UDim2.new(0, 0, 0.1 * i, 0)
		label.Size = UDim2.new(0.5, 0, 0.1, 0)
		label.BackgroundTransparency = 1
		label.TextScaled = true
		label.TextColor3 = Color3.fromRGB(253, 128, 50)

		local box = Instance.new("TextBox", frame)
		box.Position = UDim2.new(0.5, 0, 0.1 * i, 0)
		box.Size = UDim2.new(0.5, 0, 0.1, 0)
		box.BackgroundColor3 = Color3.new(1, 1, 1)
		box.TextScaled = true
		inputs[i] = box
	end

	local confirmButton = Instance.new("TextButton", frame)
	confirmButton.Text = "OK"
	confirmButton.Position = UDim2.new(0.35, 0, 0.9, 0)
	confirmButton.Size = UDim2.new(0.3, 0, 0.1, 0)
	confirmButton.TextScaled = true
	confirmButton.MouseButton1Click:Connect(function()
		local args = {}
		for i, box in ipairs(inputs) do
			table.insert(args, box.Text)
		end
		inputDialog:Destroy()
		onConfirm(string.format("%s(%s)", commandName, table.concat(args, ", ")))
	end)

	local example = Instance.new("TextLabel", frame)
	example.Text = "Example: " .. command.example
	example.TextColor3 = Color3.fromRGB(253, 128, 50)
	example.Position = UDim2.new(0, 0, 0, 0)
	example.Size = UDim2.new(1, 0, 0.1, 0)
	example.BackgroundTransparency = 1
	example.TextScaled = true
end

local function addCommand(commandStr)
	table.insert(commandList, commandStr)
	updateScrollFrame()
end

function updateScrollFrame()
	mainscrollframeleft:ClearAllChildren()
	for i, command in ipairs(commandList) do
		local button = Instance.new("TextButton", mainscrollframeleft)
		button.Text = command
		button.TextColor3 = Color3.fromRGB(253, 128, 50)
		button.Size = UDim2.new(1, 0, 0.05, 0)
		button.Position = UDim2.new(0, 0, 0.05 * (i - 1), 0)
		button.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
		button.TextScaled = true

		local function moveCommand(offset)
			local targetIndex = i + offset
			if targetIndex >= 1 and targetIndex <= #commandList then
				commandList[i], commandList[targetIndex] = commandList[targetIndex], commandList[i]
				updateScrollFrame()
			end
		end

		button.MouseButton1Click:Connect(function()
			local options = Instance.new("ScreenGui", PlayerGui)
			local frame = Instance.new("Frame", options)
			frame.Size = UDim2.new(0.2, 0, 0.2, 0)
			frame.Position = UDim2.new(0.4, 0, 0.4, 0)
			frame.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)

			local up = Instance.new("TextButton", frame)
			up.Text = "Move Up"
			up.TextColor3 = Color3.fromRGB(253, 128, 50)
			up.Size = UDim2.new(1, 0, 0.3, 0)
			up.Position = UDim2.new(0, 0, 0, 0)
			up.TextScaled = true
			up.MouseButton1Click:Connect(function()
				moveCommand(-1)
				options:Destroy()
			end)

			local down = Instance.new("TextButton", frame)
			down.Text = "Move Down"
			down.TextColor3 = Color3.fromRGB(253, 128, 50)
			down.Size = UDim2.new(1, 0, 0.3, 0)
			down.Position = UDim2.new(0, 0, 0.3, 0)
			down.TextScaled = true
			down.MouseButton1Click:Connect(function()
				moveCommand(1)
				options:Destroy()
			end)

			local remove = Instance.new("TextButton", frame)
			remove.Text = "Remove"
			remove.TextColor3 = Color3.fromRGB(253, 128, 50)
			remove.Size = UDim2.new(1, 0, 0.3, 0)
			remove.Position = UDim2.new(0, 0, 0.6, 0)
			remove.TextScaled = true
			remove.MouseButton1Click:Connect(function()
				table.remove(commandList, i)
				updateScrollFrame()
				options:Destroy()
			end)

			local exit = Instance.new("TextButton", frame)
			exit.Text = "Exit ui"
			exit.TextColor3 = Color3.fromRGB(253, 128, 50)
			exit.Size = UDim2.new(1, 0, 0.3, 0)
			exit.Position = UDim2.new(0, 0, 0.9, 0)
			exit.TextScaled = true
			exit.MouseButton1Click:Connect(function()
				updateScrollFrame()
				options:Destroy()
			end)
		end)
	end
end

-- UI Setup
mainui = Instance.new("ScreenGui", PlayerGui)
mainui.IgnoreGuiInset = false
mainui.ResetOnSpawn = false

mainscrollframeleft = Instance.new("ScrollingFrame", mainui)
mainscrollframeleft.Position = UDim2.new(0, 0, 0.151, 0)
mainscrollframeleft.Size = UDim2.new(0.297, 0, 0.553, 0)

runtextbutton = Instance.new("TextButton", mainui)
runtextbutton.Position = UDim2.new(0, 0, 0.718, 0)
runtextbutton.Size = UDim2.new(0.297, 0, 0.122, 0)
runtextbutton.Text = "Run"
runtextbutton.TextScaled = true

additembutton = Instance.new("TextButton", mainui)
additembutton.Position = UDim2.new(0.303, 0, 0.15, 0)
additembutton.Size = UDim2.new(0.1, 0, 0.083, 0)
additembutton.Text = "Add command"
additembutton.TextScaled = true

getcamposbutton = Instance.new("TextButton", mainui)
getcamposbutton.Position = UDim2.new(0.303, 0, 0.25, 0)
getcamposbutton.Size = UDim2.new(0.1, 0, 0.083, 0)
getcamposbutton.Text = "Get camera position"
getcamposbutton.TextScaled = true

savecommandsbutton = Instance.new("TextButton", mainui)
savecommandsbutton.Position = UDim2.new(0.303, 0, 0.35, 0)
savecommandsbutton.Size = UDim2.new(0.1, 0, 0.083, 0)
savecommandsbutton.Text = "Save commands"
savecommandsbutton.TextScaled = true

loadcommandsbutton = Instance.new("TextButton", mainui)
loadcommandsbutton.Position = UDim2.new(0.303, 0, 0.45, 0)
loadcommandsbutton.Size = UDim2.new(0.1, 0, 0.083, 0)
loadcommandsbutton.Text = "Load commands"
loadcommandsbutton.TextScaled = true

showcommandtext = Instance.new("TextBox", mainui)
showcommandtext.Position = UDim2.new(0.303, 0, 0.55, 0)
showcommandtext.Size = UDim2.new(0.12, 0, 0.1, 0)
showcommandtext.ClearTextOnFocus = false
showcommandtext.Text = "Saved commands show here to copy and paste"
showcommandtext.TextScaled = true

showpostext = Instance.new("TextBox", mainui)
showpostext.Position = UDim2.new(0.303, 0, 0.67, 0)
showpostext.Size = UDim2.new(0.12, 0, 0.1, 0)
showpostext.ClearTextOnFocus = false
showpostext.Text = "Saved camera pos show here"
showpostext.TextScaled = true

toggleuibutton = Instance.new("TextButton", mainui)
toggleuibutton.Position = UDim2.new(0.314, 0, 0.8, 0)
toggleuibutton.Size = UDim2.new(0.1, 0, 0.1, 0)
toggleuibutton.Text = "Toggle UI"
toggleuibutton.TextScaled = true
toggleuibutton.Name = "ToggleUiButton"
toggleuibutton.ZIndex = 2147483647

task.spawn(function()
	game["Run Service"].RenderStepped:Connect(function()
		if global1 == true then
			game.Players.LocalPlayer.Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
			game.Players.LocalPlayer.Character.HumanoidRootPart.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
		end
	end)
end)

toggleuibutton.MouseButton1Click:Connect(function()
	for _, v in ipairs(mainui:GetChildren()) do
		if v.Name ~= "ToggleUiButton" then
			v.Visible = not v.Visible
		end
	end
end)

additembutton.MouseButton1Click:Connect(function()
	local picker = Instance.new("ScreenGui", PlayerGui)
	local frame = Instance.new("Frame", picker)
	frame.Size = UDim2.new(0.3, 0, 0.5, 0)
	frame.Position = UDim2.new(0.35, 0, 0.25, 0)
	frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)

	local yOffset = 0
	for commandName, _ in pairs(AvailableCommands) do
		local btn = Instance.new("TextButton", frame)
		btn.Text = commandName
		btn.Position = UDim2.new(0, 0, yOffset, 0)
		btn.Size = UDim2.new(1, 0, 0.1, 0)
		btn.TextScaled = true
		yOffset += 0.1
		btn.MouseButton1Click:Connect(function()
			picker:Destroy()
			showCommandDialog(commandName, function(commandStr)
				addCommand(commandStr)
			end)
		end)
	end
end)

runtextbutton.MouseButton1Click:Connect(runCommands)

savecommandsbutton.MouseButton1Click:Connect(function()
	local saveStr = table.concat(commandList, "@")
	showcommandtext.Text = saveStr
	print(saveStr)
end)

loadcommandsbutton.MouseButton1Click:Connect(function()
	local inputStr = showcommandtext.Text
	commandList = {}
	for command in string.gmatch(inputStr, "([^@]+)") do
		table.insert(commandList, command)
	end
	updateScrollFrame()
end)

getcamposbutton.MouseButton1Click:Connect(function()
	local cam = workspace.CurrentCamera
	local pos = cam.CFrame.Position
	showpostext.Text = string.format("Vector3.new(%.2f, %.2f, %.2f)", pos.X, pos.Y, pos.Z)
end)

Features & Information

Set up macro's and save them in text and load them later Add commands to do actions
#macro#Macro

Community Comments (1)

voltexvoltexJun 14, 2025

def not skidded

More Scripts for Universal Scripts