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