I have been trying to make a game where you can click on a square to paint (pixel art) currently I wanted to make a script where you click on a brick which changes the colour of your "paint".
For the actual drawing script without the colour change, I wrote this:
local part = script.Parent
local clickDetector = script.Parent.ClickDetector
clickDetector.MouseClick:Connect(function()
part.BrickColor = BrickColor.new("Black")
end)
clickDetector.RightMouseClick:Connect(function()
part.BrickColor = BrickColor.new("White")
end)
This script only changes the colour of the tile that you click on, and it is only able to paint in one colour. I tried to figure out how to do the colour change script. So I added a part that you click on to change the colour of the paint. I put in a click detector and i added the change colour part into the painting script. Can someone tell me if this is correct? And if it isn't, please help.
local part = script.Parent
local clickDetector = script.Parent.ClickDetector
local changeColour = script.Parent.Parent.changeColourBlue.ClickDetector
changeColour.MouseClick:Connect(function()
clickDetector.MouseClick:Connect(function()
part.BrickColor = BrickColor.new("Blue")
end)
clickDetector.RightMouseClick:Connect(function()
part.BrickColor = BrickColor.new("White")
end)
end)
I will appriciate it if someone helped me. <3
