Whiteboard colour issue

Yes, it is possible. I also added color switching. But you will have to make one change, for the buttons you have to change the color you add Attribute (click on the button it’s at the very bottom) you add attribute the name will always be dotColor and the type be Color3 (there you will change the color).
And buttons can have any name.

--Service
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()

--Gui
local frame = script.Parent
local ClearButton = script.Parent:WaitForChild("ClearButton")

--Value
local dotColor = Color3.new(0,0,0)
local pressed = false
local x,y,dot

mouse.Button1Down:Connect(function()
	pressed = true
end)

mouse.Button1Up:Connect(function()
	pressed = false
end)

game:GetService("RunService").RenderStepped:Connect(function()
	x = mouse.X; y = mouse.Y
	if pressed == true then
		dot = Instance.new("Frame")
		dot.Name = "Dot"
		dot.Parent = frame
		dot.BackgroundColor3 = dotColor
		dot.Size = UDim2.new(0, 6, 0, 6)
		dot.Position = UDim2.new(0, x - frame.AbsolutePosition.X, 0, y - frame.AbsolutePosition.Y)
	end
end)

ClearButton.MouseButton1Click:Connect(function()
	for i, q in pairs(frame:GetChildren()) do
		if q.Name == "Dot" then
			q:Destroy()
		end
	end
end)

for number,buttons in pairs(frame:GetChildren()) do --get all things
	if buttons:IsA("TextButton") and buttons:GetAttribute("dotColor") then -- filter buttons with attribute named dotcolor
		buttons.MouseButton1Up:Connect(function()
			dotColor = buttons:GetAttribute("dotColor") --change dotcolor to color in attribute
		end)
	end
end
1 Like

I have read this multiple times to try and get it correct this is what i have figured out?

for number,buttons in pairs(frame:GetChildren()) do --get all things
if buttons:IsA(“RedButton”) and buttons:GetAttribute(“dotColor”) then – filter buttons with attribute named dotcolor
buttons.MouseButton1Up:Connect(function()
dotColor = buttons:GetAttribute(“dotColor”) --change dotcolor to color in attribute
end)
end
end

No i script it for all buttons, there is nothing to change. I just want you to create an attribute for each button. At the end of the picture. (There you set a different color for each button. Which you will then paint when you click on the button).

1 Like

Thank you this is my 1st time using Attributes -Edit this all works thank you so much 1 thing how would you get ride of the border size pixels

under dot.Name = “Dot” add dot.BorderSizePixel = 0

1 Like

Thank you for the help! Appreciated helps a lot

How difficult would a quick fill bucket be to add in?

It’s definitely more complicated and since I don’t do much with 2D graphics, it would be better to create a new ticket.

A new ticket as in like coding or Attributes?

I mean ticket like topic in this category.

1 Like