-- LocalScript inside a ScreenGui (StarterGui) local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -- Locate F3X SyncAPI ServerEndpoint (adjust path if your game renames BuildingTools) local function getSyncEndpoint() local tool = player.Backpack:FindFirstChild("Building Tools") or (player.Character and player.Character:FindFirstChild("Building Tools")) or ReplicatedStorage:FindFirstChild("BuildingTools") if tool then local syncApi = tool:FindFirstChild("SyncAPI") if syncApi and syncApi:FindFirstChild("ServerEndpoint") then return syncApi.ServerEndpoint end end -- Fallback search across workspace/ReplicatedStorage if nested for _, container in ipairs({ workspace, ReplicatedStorage, playerGui }) do local found = container:FindFirstChild("ServerEndpoint", true) if found and found:IsA("RemoteFunction") then return found end end return nil end -- Sample 12x12 voxel color map (nil/space = transparent/skip) local SAMPLE_VOXELS = { { nil, nil, "FF595E", "FF595E", nil, nil, nil, nil, "FF595E", "FF595E", nil, nil }, { nil, "FF595E", "FFCA3A", "FF595E", "FF595E", nil, nil, "FF595E", "FF595E", "FF595E", "FF595E", nil }, { "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E" }, { "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E" }, { "FF595E", "FF595E", "1982C4", "1982C4", "FF595E", "FF595E", "FF595E", "FF595E", "1982C4", "1982C4", "FF595E", "FF595E" }, { "FF595E", "FF595E", "1982C4", "FFFFFF", "FF595E", "FF595E", "FF595E", "FF595E", "1982C4", "FFFFFF", "FF595E", "FF595E" }, { "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "8AC926", "8AC926", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E" }, { nil, "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", nil }, { nil, nil, "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", "FF595E", nil, nil }, { nil, "FF595E", nil, "FF595E", "FF595E", nil, nil, "FF595E", "FF595E", nil, "FF595E", nil }, { "FF595E", nil, nil, nil, "FF595E", nil, nil, "FF595E", nil, nil, nil, "FF595E" }, { nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil }, } local function hexToColor3(hex) hex = hex:gsub("#", ""):gsub("%s+", "") if #hex ~= 6 then return Color3.fromRGB(255, 255, 255) end local r = tonumber(hex:sub(1, 2), 16) or 255 local g = tonumber(hex:sub(3, 4), 16) or 255 local b = tonumber(hex:sub(5, 6), 16) or 255 return Color3.fromRGB(r, g, b) end -- Parse rows like: RRGGBB, RRGGBB, ., RRGGBB local function parseGridText(text) local grid = {} for line in text:gmatch("[^\r\n]+") do local trimmed = line:match("^%s*(.-)%s*$") if trimmed ~= "" and not trimmed:match("^%-%-") then local row = {} for token in trimmed:gmatch("[^,%s]+") do if token == "." or token == "-" or token:lower() == "nil" or token:lower() == "none" then table.insert(row, false) else table.insert(row, token) end end if #row > 0 then table.insert(grid, row) end end end return grid end local function sampleToText(grid) local lines = {} for _, row in ipairs(grid) do local cells = {} for _, cell in ipairs(row) do table.insert(cells, cell or ".") end table.insert(lines, table.concat(cells, ", ")) end return table.concat(lines, "\n") end -- Build GUI local screenGui = Instance.new("ScreenGui") screenGui.Name = "F3XVoxelImageLoaderGui" screenGui.ResetOnSpawn = false screenGui.Parent = playerGui local frame = Instance.new("Frame") frame.Size = UDim2.fromOffset(360, 430) frame.Position = UDim2.fromScale(0.03, 0.22) frame.BackgroundColor3 = Color3.fromRGB(24, 26, 32) frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true frame.Parent = screenGui Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 8) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -20, 0, 34) title.Position = UDim2.fromOffset(10, 6) title.BackgroundTransparency = 1 title.Text = "3D Voxel F3X Image Loader" title.TextColor3 = Color3.fromRGB(240, 244, 255) title.Font = Enum.Font.GothamBold title.TextSize = 16 title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = frame local function makeInput(labelText, defaultVal, yPos) local lbl = Instance.new("TextLabel") lbl.Size = UDim2.fromOffset(145, 26) lbl.Position = UDim2.fromOffset(10, yPos) lbl.BackgroundTransparency = 1 lbl.Text = labelText lbl.TextColor3 = Color3.fromRGB(185, 192, 210) lbl.Font = Enum.Font.Gotham lbl.TextSize = 12 lbl.TextXAlignment = Enum.TextXAlignment.Left lbl.Parent = frame local box = Instance.new("TextBox") box.Size = UDim2.fromOffset(195, 26) box.Position = UDim2.fromOffset(155, yPos) box.BackgroundColor3 = Color3.fromRGB(36, 40, 50) box.Text = tostring(defaultVal) box.TextColor3 = Color3.fromRGB(255, 255, 255) box.Font = Enum.Font.Code box.TextSize = 12 box.ClearTextOnFocus = false box.Parent = frame Instance.new("UICorner", box).CornerRadius = UDim.new(0, 5) return box end local voxelSizeBox = makeInput("Voxel Size (studs):", 1, 46) local depthBox = makeInput("3D Depth (layers):", 2, 78) local materialBox = makeInput("Material:", "SmoothPlastic", 110) local delayBox = makeInput("Step Delay (sec):", 0.01, 142) local editor = Instance.new("TextBox") editor.Size = UDim2.fromOffset(340, 165) editor.Position = UDim2.fromOffset(10, 176) editor.BackgroundColor3 = Color3.fromRGB(16, 18, 23) editor.Text = sampleToText(SAMPLE_VOXELS) editor.TextColor3 = Color3.fromRGB(215, 225, 245) editor.Font = Enum.Font.Code editor.TextSize = 11 editor.MultiLine = true editor.ClearTextOnFocus = false editor.TextXAlignment = Enum.TextXAlignment.Left editor.TextYAlignment = Enum.TextYAlignment.Top editor.Parent = frame Instance.new("UICorner", editor).CornerRadius = UDim.new(0, 6) local buildBtn = Instance.new("TextButton") buildBtn.Size = UDim2.fromOffset(164, 34) buildBtn.Position = UDim2.fromOffset(10, 350) buildBtn.BackgroundColor3 = Color3.fromRGB(59, 130, 246) buildBtn.Text = "Build Voxels" buildBtn.TextColor3 = Color3.fromRGB(255, 255, 255) buildBtn.Font = Enum.Font.GothamBold buildBtn.TextSize = 13 buildBtn.Parent = frame Instance.new("UICorner", buildBtn).CornerRadius = UDim.new(0, 6) local stopBtn = Instance.new("TextButton") stopBtn.Size = UDim2.fromOffset(164, 34) stopBtn.Position = UDim2.fromOffset(186, 350) stopBtn.BackgroundColor3 = Color3.fromRGB(220, 38, 38) stopBtn.Text = "Stop Build" stopBtn.TextColor3 = Color3.fromRGB(255, 255, 255) stopBtn.Font = Enum.Font.GothamBold stopBtn.TextSize = 13 stopBtn.Parent = frame Instance.new("UICorner", stopBtn).CornerRadius = UDim.new(0, 6) local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.new(1, -20, 0, 22) statusLabel.Position = UDim2.fromOffset(10, 392) statusLabel.BackgroundTransparency = 1 statusLabel.Text = "Ready (use '.' for empty voxels)" statusLabel.TextColor3 = Color3.fromRGB(150, 220, 170) statusLabel.Font = Enum.Font.Gotham statusLabel.TextSize = 11 statusLabel.TextXAlignment = Enum.TextXAlignment.Left statusLabel.Parent = frame local isBuilding = false local cancelRequested = false stopBtn.MouseButton1Click:Connect(function() if isBuilding then cancelRequested = true statusLabel.Text = "Stopping..." end end) local function createF3XVoxel(endpoint, cframe, sizeVec, color3, materialEnum) -- 1. Create normal part via F3X SyncAPI local part = endpoint:InvokeServer("CreatePart", "Normal", cframe, workspace) if not part then return nil end -- 2. Resize, anchor, color, and set material through SyncAPI endpoint:InvokeServer("SyncResize", { { Part = part, CFrame = cframe, Size = sizeVec }, }) endpoint:InvokeServer("SyncAnchor", { { Part = part, Anchored = true }, }) endpoint:InvokeServer("SyncColor", { { Part = part, Color = color3, UnionColoring = true }, }) endpoint:InvokeServer("SyncMaterial", { { Part = part, Material = materialEnum, Transparency = 0 }, }) return part end buildBtn.MouseButton1Click:Connect(function() if isBuilding then return end local endpoint = getSyncEndpoint() if not endpoint then statusLabel.Text = "Error: F3X SyncAPI ServerEndpoint not found." statusLabel.TextColor3 = Color3.fromRGB(255, 110, 110) return end local voxelSize = tonumber(voxelSizeBox.Text) or 1 local depthLayers = math.max(1, math.floor(tonumber(depthBox.Text) or 1)) local stepDelay = math.max(0, tonumber(delayBox.Text) or 0) local materialEnum = Enum.Material[materialBox.Text] or Enum.Material.SmoothPlastic local grid = parseGridText(editor.Text) if #grid == 0 then statusLabel.Text = "Error: Grid is empty." statusLabel.TextColor3 = Color3.fromRGB(255, 110, 110) return end local char = player.Character local root = char and char:FindFirstChild("HumanoidRootPart") local originPos = root and (root.Position + root.CFrame.LookVector * 12 + Vector3.new(0, 6, 0)) or Vector3.new(0, 10, 0) local baseCFrame = CFrame.lookAt(originPos, originPos + (root and root.CFrame.LookVector or Vector3.new(0, 0, -1))) isBuilding = true cancelRequested = false statusLabel.TextColor3 = Color3.fromRGB(150, 220, 170) task.spawn(function() local height = #grid local createdCount = 0 local sizeVec = Vector3.new(voxelSize, voxelSize, voxelSize) for y = 1, height do if cancelRequested then break end local row = grid[y] for x = 1, #row do if cancelRequested then break end local hex = row[x] if hex and hex ~= false then local color3 = hexToColor3(hex) -- Top-to-bottom Y, left-to-right X local localX = (x - (#row / 2 + 0.5)) * voxelSize local localY = ((height / 2 + 0.5) - y) * voxelSize for z = 1, depthLayers do if cancelRequested then break end local localZ = (z - 1) * voxelSize local worldCF = baseCFrame * CFrame.new(localX, localY, localZ) createF3XVoxel(endpoint, worldCF, sizeVec, color3, materialEnum) createdCount += 1 if stepDelay > 0 then task.wait(stepDelay) end end end end statusLabel.Text = string.format("Building row %d/%d (%d voxels)...", y, height, createdCount) RunService.Heartbeat:Wait() end isBuilding = false statusLabel.Text = cancelRequested and string.format("Stopped at %d voxels.", createdCount) or string.format("Done! Created %d F3X voxels.", createdCount) end) end)