--Make brush cursor follow mouse and put paint where the player clicks

game:GetService("RunService").Stepped:Connect(function()
	
	if canvas.Visible == true and cursor.Visible == true then
		
		local x = math.abs(mouse.X - canvas.AbsolutePosition.X)
		local y = math.abs(mouse.Y - canvas.AbsolutePosition.Y)
		
		cursor.Position = UDim2.new(x/canvas.AbsoluteSize.X, 0, y/canvas.AbsoluteSize.Y, 0)
		cursor.Size = UDim2.new(0, currentSize, 0, currentSize)
	
		if down then
				
			local paint = script.Paint:Clone()
				
			paint.Position = UDim2.new(x/canvas.AbsoluteSize.X, 0, y/canvas.AbsoluteSize.Y, 0)
			paint.Size = UDim2.new(0, currentSize, 0, currentSize)
				
			paint.ImageColor3 = erasing and Color3.fromRGB(185, 185, 185) or currentColor
				
			paint.Parent = paintContainer
		end
	end
end)

