Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Spray Paint Auto Draw Script with Image Preview
- Controls:
- [R] - Show Preview
- [T] - Start Auto Draw
- [X] - Remove Preview
- --]]
- -- Image URL (can be your image from imgur or similar, must be .png/.jpg)
- local imageUrl = "https://chat.openai.com/sandbox:/mnt/data/goodbye_preview.png" -- replace with your uploaded image URL
- -- GUI Setup
- local player = game.Players.LocalPlayer
- local previewGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
- previewGui.Name = "AutoDrawPreview"
- previewGui.ResetOnSpawn = false
- previewGui.Enabled = false
- local imageLabel = Instance.new("ImageLabel", previewGui)
- imageLabel.Size = UDim2.new(0, 300, 0, 300)
- imageLabel.Position = UDim2.new(0.5, -150, 0.5, -150)
- imageLabel.BackgroundTransparency = 1
- imageLabel.ImageTransparency = 0.3
- imageLabel.Image = imageUrl
- imageLabel.Visible = false
- -- Draw data (example)
- local drawData = {
- {0, 0, 255, 0, 0}, -- red pixel
- {1, 0, 0, 255, 0}, -- green pixel
- {2, 0, 0, 0, 255}, -- blue pixel
- }
- -- Drawing config
- local delay = 0.005
- local offsetX = 500
- local offsetY = 300
- local pixelSize = 2
- local lastColor = ""
- function roundColor(r, g, b)
- local step = 17
- local function round(v) return math.floor(v / step + 0.5) * step end
- return round(r), round(g), round(b)
- end
- function setColor(r, g, b)
- local new = table.concat({r, g, b}, ",")
- if new ~= lastColor then
- game:GetService("ReplicatedStorage").SetSprayColor:FireServer(Color3.fromRGB(r, g, b))
- lastColor = new
- wait(0.01)
- end
- end
- function drawPixel(x, y, r, g, b)
- local screenX = offsetX + x * pixelSize
- local screenY = offsetY + y * pixelSize
- setColor(r, g, b)
- mousemoveabs(screenX, screenY)
- mouse1click()
- wait(delay)
- end
- function startDrawing()
- for _, point in ipairs(drawData) do
- local x, y, r, g, b = unpack(point)
- local rr, gg, bb = roundColor(r, g, b)
- drawPixel(x, y, rr, gg, bb)
- end
- print("✅ Drawing Complete!")
- end
- -- Keybinds
- local UIS = game:GetService("UserInputService")
- UIS.InputBegan:Connect(function(input, gameProcessed)
- if gameProcessed then return end
- if input.KeyCode == Enum.KeyCode.R then
- previewGui.Enabled = true
- imageLabel.Visible = true
- elseif input.KeyCode == Enum.KeyCode.X then
- previewGui.Enabled = false
- imageLabel.Visible = false
- elseif input.KeyCode == Enum.KeyCode.T then
- previewGui.Enabled = false
- imageLabel.Visible = false
- startDrawing()
- end
- end)
- print("🎨 Press R to preview, T to draw, X to cancel preview.")
Advertisement
Add Comment
Please, Sign In to add comment