0% found this document useful (0 votes)
35 views13 pages

Auto-Build System for Rayfield UI

This document outlines an auto-build system for a game using Rayfield UI, allowing players to build structures by selecting block types and specifying coordinates or ranges. It includes features for finding remote events, configuring build settings, and tracking the status of the building process. The system supports multiple block types and provides user-friendly interfaces for inputting parameters and viewing build progress.

Uploaded by

chatgptsahraoui
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)
35 views13 pages

Auto-Build System for Rayfield UI

This document outlines an auto-build system for a game using Rayfield UI, allowing players to build structures by selecting block types and specifying coordinates or ranges. It includes features for finding remote events, configuring build settings, and tracking the status of the building process. The system supports multiple block types and provides user-friendly interfaces for inputting parameters and viewing build progress.

Uploaded by

chatgptsahraoui
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

-- AUTO-BUILD SYSTEM - RAYFIELD UI VERSION

-- Compatible with all major executors

local Rayfield = loadstring(game:HttpGet('[Link]

-- Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local player = [Link]

-- Find PlaceBlock remote (corrected path)


local PlaceBlockRemote
local function findPlaceBlockRemote()
local possiblePaths = {
ReplicatedStorage:FindFirstChild("Remotes") and
[Link]:FindFirstChild("Events") and
[Link]:FindFirstChild("PlaceBlock"),

ReplicatedStorage:FindFirstChild("PlaceBlock"),
ReplicatedStorage:FindFirstChild("Events") and
[Link]:FindFirstChild("PlaceBlock"),
ReplicatedStorage:FindFirstChild("RemoteEvents") and
[Link]:FindFirstChild("PlaceBlock"),
}

for _, remote in ipairs(possiblePaths) do


if remote then
PlaceBlockRemote = remote
print("✅ Found PlaceBlock at:", remote:GetFullName())
return true
end
end
return false
end

-- Try to find remote


spawn(function()
while not PlaceBlockRemote do
if findPlaceBlockRemote() then break end
wait(1)
end
end)

-- Configuration
local Config = {
BlockTypes = {"Block"}, -- Now supports multiple block types
BuildMode = "Range",

-- Range Mode (now using string inputs)


XFrom = "0",
XTo = "10",
YFrom = "0",
YTo = "5",
ZFrom = "0",
ZTo = "10",

-- Coordinate Mode
Coordinates = "0,0,0",

-- Settings
BuildDelay = 0.1,
IsBuilding = false
}

local BLOCK_TYPES = {"MetalSpikes","SteelBlock",


"LunarBlock","StoneBlock","MetalBlock","Turret" ,"Block", "CrossbowTurret",
"Spikes", "StoneSpikes", "DoubleTurret" ,
"CannonTurret","DoubleRaygun","FreezeTurret","RayGun","TeslaCoil"}

-- Create Rayfield Window


local Window = Rayfield:CreateWindow({
Name = "🔧 Auto-Build System",
LoadingTitle = "Auto-Build Loading...",
LoadingSubtitle = "by YourName",
ConfigurationSaving = {
Enabled = true,
FolderName = "AutoBuildConfig",
FileName = "AutoBuild"
},
Discord = {
Enabled = false,
Invite = "noinvite",
RememberJoins = false
},
KeySystem = false
})

-- Main Tab
local MainTab = Window:CreateTab(" Main", 4483362458)

-- Status Section
local StatusSection = MainTab:CreateSection("Status")

local StatusParagraph = MainTab:CreateParagraph({


Title = "Remote Status",
Content = "🔍 Searching for PlaceBlock remote..."
})

-- Update status when remote is found


spawn(function()
while not PlaceBlockRemote do wait(1) end
StatusParagraph:Set({
Title = "Remote Status",
Content = "✅ PlaceBlock remote found and ready!"
})
end)

local BuildStatusParagraph = MainTab:CreateParagraph({


Title = "Build Status",
Content = "⏳ Ready to build"
})

-- Block Configuration Section


local BlockSection = MainTab:CreateSection("Block Configuration")

local BlockTypeDropdown = MainTab:CreateDropdown({


Name = "Block Types (Multiple Selection)",
Options = BLOCK_TYPES,
CurrentOption = {"Block"},
MultipleOptions = true, -- Enable multiple selection
Flag = "BlockTypes",
Callback = function(Options)
[Link] = Options
print("Selected block types:", [Link](Options, ", "))
end,
})

-- Build Mode Section


local ModeSection = MainTab:CreateSection("Build Mode")

local BuildModeDropdown = MainTab:CreateDropdown({


Name = "Build Mode",
Options = {"Range", "Coordinates"},
CurrentOption = {"Range"},
MultipleOptions = false,
Flag = "BuildMode",
Callback = function(Option)
[Link] = Option[1]
print("Selected build mode:", [Link])
end,
})

-- Range Mode Tab (now with text inputs)


local RangeTab = Window:CreateTab("📦 Range Mode", 4483362458)

local RangeSection = RangeTab:CreateSection("X Axis Range")

local XFromInput = RangeTab:CreateInput({


Name = "X From",
PlaceholderText = "0",
RemoveTextAfterFocusLost = false,
Flag = "XFromInput",
Callback = function(Text)
[Link] = Text
end,
})

local XToInput = RangeTab:CreateInput({


Name = "X To",
PlaceholderText = "10",
RemoveTextAfterFocusLost = false,
Flag = "XToInput",
Callback = function(Text)
[Link] = Text
end,
})

local YRangeSection = RangeTab:CreateSection("Y Axis Range")

local YFromInput = RangeTab:CreateInput({


Name = "Y From",
PlaceholderText = "0",
RemoveTextAfterFocusLost = false,
Flag = "YFromInput",
Callback = function(Text)
[Link] = Text
end,
})

local YToInput = RangeTab:CreateInput({


Name = "Y To",
PlaceholderText = "5",
RemoveTextAfterFocusLost = false,
Flag = "YToInput",
Callback = function(Text)
[Link] = Text
end,
})

local ZRangeSection = RangeTab:CreateSection("Z Axis Range")

local ZFromInput = RangeTab:CreateInput({


Name = "Z From",
PlaceholderText = "0",
RemoveTextAfterFocusLost = false,
Flag = "ZFromInput",
Callback = function(Text)
[Link] = Text
end,
})

local ZToInput = RangeTab:CreateInput({


Name = "Z To",
PlaceholderText = "10",
RemoveTextAfterFocusLost = false,
Flag = "ZToInput",
Callback = function(Text)
[Link] = Text
end,
})

-- Quick Range Presets (updated to use text inputs)


local PresetSection = RangeTab:CreateSection("Quick Presets")

RangeTab:CreateButton({
Name = "Small House (10x10x10)",
Callback = function()
XFromInput:Set("0")
XToInput:Set("10")
YFromInput:Set("0")
YToInput:Set("10")
ZFromInput:Set("0")
ZToInput:Set("10")
Rayfield:Notify({
Title = "Preset Applied",
Content = "Small House preset loaded",
Duration = 2,
Image = 4483362458,
})
end,
})

RangeTab:CreateButton({
Name = "Wall (20x5x1)",
Callback = function()
XFromInput:Set("0")
XToInput:Set("20")
YFromInput:Set("0")
YToInput:Set("5")
ZFromInput:Set("0")
ZToInput:Set("1")
Rayfield:Notify({
Title = "Preset Applied",
Content = "Wall preset loaded",
Duration = 2,
Image = 4483362458,
})
end,
})

RangeTab:CreateButton({
Name = "Floor (15x1x15)",
Callback = function()
XFromInput:Set("0")
XToInput:Set("15")
YFromInput:Set("0")
YToInput:Set("1")
ZFromInput:Set("0")
ZToInput:Set("15")
Rayfield:Notify({
Title = "Preset Applied",
Content = "Floor preset loaded",
Duration = 2,
Image = 4483362458,
})
end,
})

-- Coordinates Tab
local CoordTab = Window:CreateTab("📍 Coordinates", 4483362458)

local CoordSection = CoordTab:CreateSection("Manual Coordinates")

local CoordinatesInput = CoordTab:CreateInput({


Name = "Coordinates",
PlaceholderText = "x,y,z or x1,y1,z1;x2,y2,z2;...",
RemoveTextAfterFocusLost = false,
Flag = "Coordinates",
Callback = function(Text)
[Link] = Text
end,
})

CoordTab:CreateParagraph({
Title = "📝 Coordinate Format Examples",
Content = "Single: 10,5,15\nMultiple: 0,0,0;10,5,15;20,0,5\nSpaced: 1, 2, 3; 4,
5, 6"
})

-- Get Player Position Button


CoordTab:CreateButton({
Name = "📍 Get My Position",
Callback = function()
if [Link] and [Link]:FindFirstChild("HumanoidRootPart")
then
local pos = [Link]
local coordString = [Link](pos.X) .. "," .. [Link](pos.Y) ..
"," .. [Link](pos.Z)
CoordinatesInput:Set(coordString)
Rayfield:Notify({
Title = "Position Captured",
Content = "Your position: " .. coordString,
Duration = 3,
Image = 4483362458,
})
else
Rayfield:Notify({
Title = "Error",
Content = "Could not get player position",
Duration = 3,
Image = 4483362458,
})
end
end,
})

-- Settings Tab
local SettingsTab = Window:CreateTab("⚙️ Settings", 4483362458)

local BuildSection = SettingsTab:CreateSection("Build Settings")

local DelaySlider = SettingsTab:CreateSlider({


Name = "Build Delay (seconds)",
Range = {0, 2},
Increment = 0.01,
Suffix = "s",
CurrentValue = 0.1,
Flag = "BuildDelay",
Callback = function(Value)
[Link] = Value
end,
})

-- Build Functions (updated for multiple complete passes)


local function placeBlock(blockType, x, y, z)
if PlaceBlockRemote then
local args = {
blockType,
[Link](x, y, z),
[Link](0, 0, 0)
}
PlaceBlockRemote:FireServer(unpack(args))
return true
else
return false
end
end

local function buildFromRange()


if not PlaceBlockRemote then
Rayfield:Notify({
Title = "Error",
Content = "PlaceBlock remote not found!",
Duration = 3,
Image = 4483362458,
})
return
end

if #[Link] == 0 then
Rayfield:Notify({
Title = "Error",
Content = "Please select at least one block type!",
Duration = 3,
Image = 4483362458,
})
return
end

-- Convert string inputs to numbers


local xFrom, xTo = tonumber([Link]) or 0, tonumber([Link]) or 10
local yFrom, yTo = tonumber([Link]) or 0, tonumber([Link]) or 5
local zFrom, zTo = tonumber([Link]) or 0, tonumber([Link]) or 10

-- Ensure proper ordering


if xFrom > xTo then xFrom, xTo = xTo, xFrom end
if yFrom > yTo then yFrom, yTo = yTo, yFrom end
if zFrom > zTo then zFrom, zTo = zTo, zFrom end

local totalBlocks = (xTo - xFrom + 1) * (yTo - yFrom + 1) * (zTo - zFrom + 1)


local blockTypeStats = {} -- Track how many of each type were placed

-- Initialize stats
for _, blockType in ipairs([Link]) do
blockTypeStats[blockType] = 0
end

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "🔨 Starting build with " .. #[Link] .. " block
types..."
})

-- Loop through each block type (complete passes)


for passIndex, currentBlockType in ipairs([Link]) do
if not [Link] then
BuildStatusParagraph:Set({
Title = "Build Status",
Content = " Build cancelled"
})
return
end

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "🔨 Pass " .. passIndex .. "/" .. #[Link] .. ":
Building with " .. currentBlockType
})

local blocksPlacedThisPass = 0
local currentBlock = 0
-- Go through ALL coordinates for this block type
for x = xFrom, xTo do
for y = yFrom, yTo do
for z = zFrom, zTo do
if not [Link] then
BuildStatusParagraph:Set({
Title = "Build Status",
Content = " Build cancelled"
})
return
end

placeBlock(currentBlockType, x, y, z)
blocksPlacedThisPass = blocksPlacedThisPass + 1
currentBlock = currentBlock + 1

if currentBlock % 10 == 0 or currentBlock == totalBlocks then


BuildStatusParagraph:Set({
Title = "Build Status",
Content = [Link]("🔨 Pass %d/%d: %s - %d/%d
blocks (%.1f%%)",
passIndex, #[Link], currentBlockType,
currentBlock, totalBlocks,
(currentBlock/totalBlocks)*100)
})
end

if [Link] > 0 then


wait([Link])
end
end
end
end

blockTypeStats[currentBlockType] = blocksPlacedThisPass

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "✅ Pass " .. passIndex .. " complete! " ..
currentBlockType .. ": " .. blocksPlacedThisPass .. " blocks"
})

-- Small delay between passes


wait(0.5)
end

-- Create final stats message


local finalStats = "Final Results:\n"
local totalPlaced = 0
for blockType, count in pairs(blockTypeStats) do
if count > 0 then
finalStats = finalStats .. "• " .. blockType .. ": " .. count .. "
blocks\n"
totalPlaced = totalPlaced + count
end
end

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "🎉 All passes complete!\n" .. finalStats
})

Rayfield:Notify({
Title = "Build Complete!",
Content = "Completed " .. #[Link] .. " passes with " ..
totalPlaced .. " total blocks placed",
Duration = 5,
Image = 4483362458,
})
end

local function buildFromCoordinates()


if not PlaceBlockRemote then
Rayfield:Notify({
Title = "Error",
Content = "PlaceBlock remote not found!",
Duration = 3,
Image = 4483362458,
})
return
end

if #[Link] == 0 then
Rayfield:Notify({
Title = "Error",
Content = "Please select at least one block type!",
Duration = 3,
Image = 4483362458,
})
return
end

local coordText = [Link]


if not coordText or coordText == "" then
Rayfield:Notify({
Title = "Error",
Content = "Please enter coordinates first!",
Duration = 3,
Image = 4483362458,
})
return
end

-- Parse coordinates
local coordinates = {}
for coordSet in coordText:gmatch("[^;]+") do
local x, y, z = coordSet:match("([^,]+),([^,]+),([^,]+)")
if x and y and z then
[Link](coordinates, {
x = tonumber(x:gsub("%s", "")),
y = tonumber(y:gsub("%s", "")),
z = tonumber(z:gsub("%s", ""))
})
end
end

if #coordinates == 0 then
Rayfield:Notify({
Title = "Error",
Content = "No valid coordinates found!",
Duration = 3,
Image = 4483362458,
})
return
end

local blockTypeStats = {} -- Track how many of each type were placed

-- Initialize stats
for _, blockType in ipairs([Link]) do
blockTypeStats[blockType] = 0
end

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "🔨 Starting build with " .. #[Link] .. " block
types..."
})

-- Loop through each block type (complete passes)


for passIndex, currentBlockType in ipairs([Link]) do
if not [Link] then
BuildStatusParagraph:Set({
Title = "Build Status",
Content = " Build cancelled"
})
return
end

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "🔨 Pass " .. passIndex .. "/" .. #[Link] .. ":
Building with " .. currentBlockType
})

local blocksPlacedThisPass = 0

-- Go through ALL coordinates for this block type


for i, coord in ipairs(coordinates) do
if not [Link] then
BuildStatusParagraph:Set({
Title = "Build Status",
Content = " Build cancelled"
})
return
end

if coord.x and coord.y and coord.z then


placeBlock(currentBlockType, coord.x, coord.y, coord.z)
blocksPlacedThisPass = blocksPlacedThisPass + 1

if i % 5 == 0 or i == #coordinates then
BuildStatusParagraph:Set({
Title = "Build Status",
Content = [Link]("🔨 Pass %d/%d: %s - %d/%d coords
(%.1f%%)",
passIndex, #[Link], currentBlockType,
i, #coordinates, (i/#coordinates)*100)
})
end

if [Link] > 0 then


wait([Link])
end
end
end

blockTypeStats[currentBlockType] = blocksPlacedThisPass

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "✅ Pass " .. passIndex .. " complete! " ..
currentBlockType .. ": " .. blocksPlacedThisPass .. " blocks"
})

-- Small delay between passes


wait(0.5)
end

-- Create final stats message


local finalStats = "Final Results:\n"
local totalPlaced = 0
for blockType, count in pairs(blockTypeStats) do
if count > 0 then
finalStats = finalStats .. "• " .. blockType .. ": " .. count .. "
blocks\n"
totalPlaced = totalPlaced + count
end
end

BuildStatusParagraph:Set({
Title = "Build Status",
Content = "🎉 All passes complete!\n" .. finalStats
})

Rayfield:Notify({
Title = "Build Complete!",
Content = "Completed " .. #[Link] .. " passes with " ..
totalPlaced .. " total blocks placed",
Duration = 5,
Image = 4483362458,
})
end

-- Build Control Section


local BuildControlSection = MainTab:CreateSection("Build Controls")

local StartBuildButton = MainTab:CreateButton({


Name = "🚀 START BUILDING",
Callback = function()
if [Link] then
Rayfield:Notify({
Title = "Already Building",
Content = "Build is already in progress!",
Duration = 2,
Image = 4483362458,
})
return
end

[Link] = true

spawn(function()
if [Link] == "Range" then
buildFromRange()
else
buildFromCoordinates()
end
[Link] = false
end)

Rayfield:Notify({
Title = "Build Started",
Content = "Building in " .. [Link] .. " mode with " ..
#[Link] .. " block types",
Duration = 3,
Image = 4483362458,
})
end,
})

local StopBuildButton = MainTab:CreateButton({


Name = " STOP BUILDING",
Callback = function()
if [Link] then
[Link] = false
Rayfield:Notify({
Title = "Build Stopped",
Content = "Build process cancelled",
Duration = 2,
Image = 4483362458,
})
else
Rayfield:Notify({
Title = "No Active Build",
Content = "No build process to stop",
Duration = 2,
Image = 4483362458,
})
end
end,
})

-- Info Tab
local InfoTab = Window:CreateTab("ℹ️ Info", 4483362458)

InfoTab:CreateSection("How to Use")

InfoTab:CreateParagraph({
Title = "🔧 Setup",
Content = "1. Select your block type\n2. Choose build mode (Range or
Coordinates)\n3. Configure your build area\n4. Set build delay if needed\n5. Click
START BUILDING"
})
InfoTab:CreateParagraph({
Title = "📦 Range Mode",
Content = "Build in a cuboid area by typing From/To coordinates for X, Y, Z
axes. Use presets for common shapes. Multiple block types will be tried in order."
})

InfoTab:CreateParagraph({
Title = "📍 Coordinate Mode",
Content = "Place blocks at specific coordinates. Format: x,y,z for single block
or x1,y1,z1;x2,y2,z2 for multiple. Multiple block types will be tried in order."
})

InfoTab:CreateParagraph({
Title = "🔄 Multiple Block Types",
Content = "Select multiple block types in the dropdown. The script will try the
first type, then fallback to the second if the first runs out, and so on."
})

InfoTab:CreateParagraph({
Title = "⚡ Performance Tips",
Content = "• Use 0.1+ second delay for large builds\n• Monitor your ping while
building\n• Stop build if experiencing lag"
})

-- Initialize
print("🔧 Auto-Build System with Rayfield UI loaded!")
print("📍 Searching for PlaceBlock remote...")

Rayfield:Notify({
Title = "Auto-Build Loaded!",
Content = "Ready to build. Configure your settings and start building!",
Duration = 5,
Image = 4483362458,
})

You might also like