Advertisement
HowToRoblox

PaintboardScript

Mar 13th, 2022
1,335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. local colours = {Color3.fromRGB(223, 223, 222), Color3.fromRGB(255, 0, 4), Color3.fromRGB(255, 119, 0), Color3.fromRGB(255, 226, 0), Color3.fromRGB(123, 255, 0), Color3.fromRGB(0, 213, 255), Color3.fromRGB(0, 55, 255), Color3.fromRGB(255, 0, 255)}
  2.  
  3. for i, canvasBlock in pairs(script.Parent:WaitForChild("Canvas"):GetChildren()) do
  4.    
  5.     canvasBlock.Color = colours[1]
  6.    
  7.     local clickDetector = Instance.new("ClickDetector", canvasBlock)
  8.    
  9.     clickDetector.MouseClick:Connect(function()
  10.        
  11.         local currentColourIndex = table.find(colours, canvasBlock.Color)
  12.        
  13.         local nextColourIndex = currentColourIndex + 1
  14.        
  15.         if nextColourIndex > #colours then nextColourIndex = 1 end
  16.        
  17.         canvasBlock.Color = colours[nextColourIndex]
  18.     end)
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement