Screen sharing in Roblox

You are doing quite a bit of unnecessary stuff, why use a numerical for loop when you can just loop all the pixels and then change the value (pixel) color that you get from the table loop

I have tested this right now and I can tell you that the version with no indexing was more stable in terms of how much time it took than the other. Here are the results based on my screen resolution: (Time is in seconds)

{
   ["With indexing"] = {
      [1] = 0.001069899999947665,
      [2] = 0.0009825000001910666,
      [3] = 0.0009697000000414846,
      [4] = 0.0009833999999955267,
      [5] = 0.0009574000000611704,
      [6] = 0.0009675999999672058,
      [7] = 0.0009805000001961162,
      [8] = 0.0009585000000242871,
      [9] = 0.0009605000000192376,
      [10] = 0.0009762999998201849,
      [11] = 0.0009660999999141495,
      [12] = 0.0009552999999868916,
      [13] = 0.0009744000001319364,
      [14] = 0.0009766000000581698,
      [15] = 0.0009595999999874039,
      [16] = 0.0009612999999717431,
      [17] = 0.0009832999999161984,
      [18] = 0.0009625000000141881,
      [19] = 0.0009612000001197885,
      [20] = 0.0009833999999955267,
      [21] = 0.0009598999999980151,
      [22] = 0.0009569999999712309,
      [23] = 0.0009756999997989624,
      [24] = 0.0009755000000950531,
      [25] = 0.0009585000000242871,
      [26] = 0.0009632999999666936,
      [27] = 0.0009817000000111875,
      [28] = 0.0009663000000728061,
      [29] = 0.0009634999998979765,
      [30] = 0.0009789999999156862,
      [31] = 0.0009651999998823158,
      [32] = 0.0009594000000561209,
      [33] = 0.0009695999999621563,
      [34] = 0.0009944000000814412,
      [35] = 0.0009881999999379332,
      [36] = 0.001025900000058755,
      [37] = 0.0009906000000228232,
      [38] = 0.0009771999998520187,
      [39] = 0.0009663000000728061,
      [40] = 0.001056799999787472,
      [41] = 0.0009873999999854277,
      [42] = 0.0009655999999722553,
      [43] = 0.001054199999998673,
      [44] = 0.001006500000130472,
      [45] = 0.001071899999942616,
      [46] = 0.0009763000000475586,
      [47] = 0.0009860999998636544,
      [48] = 0.0009986000000026252,
      [49] = 0.001029499999958716,
      [50] = 0.0009995000000344589,
      [51] = 0.0009873999999854277,
      [52] = 0.001063700000031531,
      [53] = 0.0009899000001496461,
      [54] = 0.001013200000215875,
      [55] = 0.0009853999999904772,
      [56] = 0.0009901999999328837,
      [57] = 0.0009840000000167493,
      [58] = 0.0009893000001284236,
      [59] = 0.001000499999918247,
      [60] = 0.0009638999999879161,
      [61] = 0.0009634999998979765,
      [62] = 0.001080000000001746,
      [63] = 0.001773899999989226,
      [64] = 0.001650200000085533,
      [65] = 0.001759400000082678,
      [66] = 0.001829199999974662,
      [67] = 0.001662099999975908,
      [68] = 0.001730500000121538,
      [69] = 0.00182730000005904,
      [70] = 0.001656299999922339,
      [71] = 0.001310399999965739,
      [72] = 0.0009853999999904772,
      [73] = 0.0009846000000379718,
      [74] = 0.0009820000000217988,
      [75] = 0.0009683999999197113,
      [76] = 0.0009668000000147003,
      [77] = 0.001004299999976865,
      [78] = 0.001225100000056045,
      [79] = 0.0009664000001521345,
      [80] = 0.0009781000001112261,
      [81] = 0.000992900000028385,
      [82] = 0.0009583999999449588,
      [83] = 0.00144189999991795,
      [84] = 0.001860999999962587,
      [85] = 0.001691700000037599,
      [86] = 0.001646799999889481,
      [87] = 0.001189899999872068,
      [88] = 0.0009883000000172615,
      [89] = 0.0009678999999778171,
      [90] = 0.001013299999840456,
      [91] = 0.0009874999998373823,
      [92] = 0.0009677000000465341,
      [93] = 0.0009610000001885055,
      [94] = 0.0009678000001258624,
      [95] = 0.0009907000001021515,
      [96] = 0.0009572999999818421,
      [97] = 0.000960400000167283,
      [98] = 0.0009815999999318592,
      [99] = 0.0009704000001420354,
      [100] = 0.0009566999999606196,
      [101] = 0.0009652999999616441
   },
   ["Without indexing"] = {
      [1] = 0.0009723999999096122,
      [2] = 0.0009437999999590829,
      [3] = 0.000942399999985355,
      [4] = 0.0009648000000197499,
      [5] = 0.0009549999999762804,
      [6] = 0.0009431000000859058,
      [7] = 0.0009479000000283122,
      [8] = 0.0009650999998029874,
      [9] = 0.000948600000128863,
      [10] = 0.0009445999999115884,
      [11] = 0.0009499000000232627,
      [12] = 0.0009678000001258624,
      [13] = 0.0009447999998428713,
      [14] = 0.0009405999999216874,
      [15] = 0.0009551000000556087,
      [16] = 0.0009570999998231855,
      [17] = 0.0009374000001116656,
      [18] = 0.0009568000000399479,
      [19] = 0.000958899999886853,
      [20] = 0.0009534000000712695,
      [21] = 0.0009379000000535598,
      [22] = 0.0009466000001339125,
      [23] = 0.000964400000157184,
      [24] = 0.0009422999999060266,
      [25] = 0.0009471999999277614,
      [26] = 0.000948800000060146,
      [27] = 0.0009708000000046013,
      [28] = 0.0009379000000535598,
      [29] = 0.0009457999999540334,
      [30] = 0.0009544999998070125,
      [31] = 0.0009554000000662199,
      [32] = 0.0009437999999590829,
      [33] = 0.0009488999999121006,
      [34] = 0.0009652999999616441,
      [35] = 0.0009548000000449974,
      [36] = 0.0009440999999696942,
      [37] = 0.0009470999998484331,
      [38] = 0.0009508999999070511,
      [39] = 0.0009678000001258624,
      [40] = 0.0009414000001015665,
      [41] = 0.0009433000000171887,
      [42] = 0.0009493000000020402,
      [43] = 0.000966899999866655,
      [44] = 0.0009459000000333617,
      [45] = 0.0009403999999904045,
      [46] = 0.0009516000000076019,
      [47] = 0.0009665000000040891,
      [48] = 0.0009440000001177395,
      [49] = 0.0009395999998105253,
      [50] = 0.0009489999999914289,
      [51] = 0.0009598999999980151,
      [52] = 0.0009537999999338354,
      [53] = 0.0009395000001859444,
      [54] = 0.0009446000001389621,
      [55] = 0.0009572999999818421,
      [56] = 0.0009551000000556087,
      [57] = 0.0009413999998741929,
      [58] = 0.0009446999999909167,
      [59] = 0.0009493999998539948,
      [60] = 0.0009692000000995904,
      [61] = 0.0009456999998747051,
      [62] = 0.0009480999999595952,
      [63] = 0.0009487999998327723,
      [64] = 0.0009658999999828666,
      [65] = 0.0009489999999914289,
      [66] = 0.0009451000000808563,
      [67] = 0.0009469999999964784,
      [68] = 0.000951099999838334,
      [69] = 0.0009600999999292981,
      [70] = 0.0009455000001707958,
      [71] = 0.0009495000001606968,
      [72] = 0.0009468000000651955,
      [73] = 0.0009562000000187254,
      [74] = 0.0009593999998287472,
      [75] = 0.0009414000001015665,
      [76] = 0.0009445000000596337,
      [77] = 0.000944800000070245,
      [78] = 0.0009577999999237363,
      [79] = 0.0009585000000242871,
      [80] = 0.0009439000000384112,
      [81] = 0.0009439000000384112,
      [82] = 0.0009489999999914289,
      [83] = 0.0009602000000086264,
      [84] = 0.0009552999999868916,
      [85] = 0.0009423000001334003,
      [86] = 0.0009446999999909167,
      [87] = 0.0009453000000121392,
      [88] = 0.0009566999999606196,
      [89] = 0.0009585999998762418,
      [90] = 0.0009471999999277614,
      [91] = 0.0009425999999166379,
      [92] = 0.0009469999999964784,
      [93] = 0.0009605000000192376,
      [94] = 0.0009619000002203393,
      [95] = 0.0009419999998954154,
      [96] = 0.0009454999999434222,
      [97] = 0.000946200000043973,
      [98] = 0.0009580000000823929,
      [99] = 0.0009632999999666936,
      [100] = 0.0009431000000859058,
      [101] = 0.000943400000096517
   }
}
1 Like

hey I have an idea? I think roblox uses hex colors too, wouldnt it be more efficient to send hex codes? it would take less space in a table and would be less complicated, but there is a quesion, is Color3.fromHex as fast as color3.fromRGB?

json can’t hex. they will just be converted to ints then but shouldn’t really change much

I will do a benchmark when I can and I will send the results in this thread.

But will it decrease or increase performance? You said json cannot be hex, I’ve managed to do that. At first it said cannot parse json but in python i converted it to json string and removed the " because somehow it didn’t work with it, i think the " just stacked. Edit: I am a total script noob, and i don’t know if you meant by ints it will be just normal characters in a string

I’ve tried it, but wouldn’t numerical loop be more efficient? I mean, i need to check but can you add in pairs to a numerical loop? I think it would be better because somewhere i read that if a table doesn’t have specified length, it takes roblox some time to check it, and in that case it would be a lot. So wouldn’t a numerical table specify it’s length or just skip that part?

what

idk how luau and python are converting ints to hex and back so i cant tell if it even slows down in the first place but its still better than storing rgb in a tuple

The results of the benchmark say that the fromRGB function is faster than doing it from hex:

{
    ["FromRGB"] = {
        [1] = 0.002002899999979491,
        [2] = 0.002060300000039206,
        [3] = 0.002533800000037445,
        [4] = 0.001938899999913701,
        [5] = 0.001909900000100606,
        [6] = 0.001968599999827347,
        [7] = 0.001934499999833861,
        [8] = 0.001847600000019156,
        [9] = 0.002003399999921385,
        [10] = 0.001879799999869647,
        [11] = 0.001985299999887502,
        [12] = 0.001837700000123732,
        [13] = 0.001855900000009569,
        [14] = 0.001950999999962733,
        [15] = 0.001888799999960611,
        [16] = 0.001832000000149492,
        [17] = 0.001890999999886844,
        [18] = 0.001980500000172469,
        [19] = 0.001833799999985786,
        [20] = 0.001828100000011545,
        [21] = 0.001926500000081433,
        [22] = 0.00193530000001374,
        [23] = 0.001826600000185863,
        [24] = 0.001878400000123293,
        [25] = 0.001970000000028449,
        [26] = 0.001867000000174812,
        [27] = 0.001822999999831154,
        [28] = 0.001901299999872208,
        [29] = 0.001989200000025448,
        [30] = 0.001834899999948902,
        [31] = 0.001858999999967637,
        [32] = 0.001954899999873305,
        [33] = 0.001908299999968222,
        [34] = 0.00183100000003833,
        [35] = 0.001883399999996982,
        [36] = 0.001993399999946632,
        [37] = 0.001825000000053478,
        [38] = 0.001838299999917581,
        [39] = 0.00192919999994956,
        [40] = 0.001945100000057209,
        [41] = 0.001829699999916556,
        [42] = 0.001867899999979272,
        [43] = 0.001969499999859181,
        [44] = 0.00185989999999947,
        [45] = 0.001829199999974662,
        [46] = 0.001902200000131415,
        [47] = 0.001974300000028961,
        [48] = 0.001823199999989811,
        [49] = 0.001858200000015131,
        [50] = 0.001952899999878355,
        [51] = 0.0019116999999369,
        [52] = 0.001822799999899871,
        [53] = 0.001882899999827714,
        [54] = 0.002000599999973929,
        [55] = 0.001936800000066796,
        [56] = 0.001842300000134856,
        [57] = 0.001843199999939316,
        [58] = 0.001943100000062259,
        [59] = 0.00191280000012739,
        [60] = 0.001834099999996397,
        [61] = 0.001880600000049526,
        [62] = 0.001974900000050184,
        [63] = 0.001850100000183375,
        [64] = 0.001827400000138368,
        [65] = 0.001923300000044037,
        [66] = 0.001954899999873305,
        [67] = 0.001839399999880698,
        [68] = 0.001861299999973198,
        [69] = 0.001952300000084506,
        [70] = 0.001898500000152126,
        [71] = 0.001828700000032768,
        [72] = 0.001890200000161713,
        [73] = 0.001984499999934997,
        [74] = 0.001846199999818054,
        [75] = 0.001841300000023693,
        [76] = 0.001924700000017765,
        [77] = 0.001941799999940486,
        [78] = 0.0018448000000717,
        [79] = 0.001860800000031304,
        [80] = 0.00196019999998498,
        [81] = 0.001880400000118243,
        [82] = 0.001845399999865549,
        [83] = 0.001976300000023912,
        [84] = 0.001861899999994421,
        [85] = 0.001986999999871841,
        [86] = 0.001827800000000934,
        [87] = 0.00184850000005099,
        [88] = 0.001931999999897016,
        [89] = 0.001916199999868695,
        [90] = 0.001823999999942316,
        [91] = 0.001885399999991932,
        [92] = 0.001970900000060283,
        [93] = 0.001872399999911067,
        [94] = 0.001825399999916044,
        [95] = 0.001915499999995518,
        [96] = 0.001960499999995591,
        [97] = 0.001823999999942316,
        [98] = 0.001861299999973198,
        [99] = 0.001942100000178471,
        [100] = 0.001904499999909604,
        [101] = 0.001834700000017619
    },
    ["FromHEX"] = {
        [1] = 0.003459900000052585,
        [2] = 0.003425700000207144,
        [3] = 0.003431699999964621,
        [4] = 0.003430099999832237,
        [5] = 0.003439100000150574,
        [6] = 0.00342769999997472,
        [7] = 0.003422300000011091,
        [8] = 0.003427300000112155,
        [9] = 0.003426100000069709,
        [10] = 0.003421899999921152,
        [11] = 0.003422799999952986,
        [12] = 0.003430399999842848,
        [13] = 0.00344319999999243,
        [14] = 0.003422199999931763,
        [15] = 0.003421500000058586,
        [16] = 0.003422799999952986,
        [17] = 0.003428299999995943,
        [18] = 0.003432399999837799,
        [19] = 0.003429899999900954,
        [20] = 0.003424300000006042,
        [21] = 0.003426199999921664,
        [22] = 0.003433000000086395,
        [23] = 0.003429099999948448,
        [24] = 0.003426199999921664,
        [25] = 0.00342569999997977,
        [26] = 0.003424500000164699,
        [27] = 0.003421600000137914,
        [28] = 0.003426300000000992,
        [29] = 0.003424200000154087,
        [30] = 0.003433100000165723,
        [31] = 0.003431000000091444,
        [32] = 0.003427099999953498,
        [33] = 0.003425099999958547,
        [34] = 0.003427500000043437,
        [35] = 0.003432900000007066,
        [36] = 0.003427299999884781,
        [37] = 0.003427799999826675,
        [38] = 0.003424499999937325,
        [39] = 0.003426100000069709,
        [40] = 0.003430999999864071,
        [41] = 0.003431599999885293,
        [42] = 0.003430600000001505,
        [43] = 0.003425800000059098,
        [44] = 0.003424600000016653,
        [45] = 0.003429999999980282,
        [46] = 0.003424799999947936,
        [47] = 0.00343010000005961,
        [48] = 0.003439899999875706,
        [49] = 0.003423699999984819,
        [50] = 0.003420700000106081,
        [51] = 0.003421699999989869,
        [52] = 0.003431099999943399,
        [53] = 0.003426499999932275,
        [54] = 0.003423800000064148,
        [55] = 0.003424100000074759,
        [56] = 0.00343660000021373,
        [57] = 0.00347250000004351,
        [58] = 0.003430800000160161,
        [59] = 0.003435000000081345,
        [60] = 0.003425900000138427,
        [61] = 0.003424100000074759,
        [62] = 0.003426300000000992,
        [63] = 0.00342680000017026,
        [64] = 0.003426700000090932,
        [65] = 0.003422300000011091,
        [66] = 0.003437999999960084,
        [67] = 0.003423400000201582,
        [68] = 0.003420699999878707,
        [69] = 0.003419699999994918,
        [70] = 0.003425100000185921,
        [71] = 0.003420999999889318,
        [72] = 0.003418499999952473,
        [73] = 0.003419399999984307,
        [74] = 0.003424899999799891,
        [75] = 0.003428499999927226,
        [76] = 0.003424699999868608,
        [77] = 0.003419099999973696,
        [78] = 0.003419299999904979,
        [79] = 0.003425600000127815,
        [80] = 0.003426700000090932,
        [81] = 0.003425999999990381,
        [82] = 0.003420900000037363,
        [83] = 0.003429699999969671,
        [84] = 0.003449100000125327,
        [85] = 0.003439099999923201,
        [86] = 0.003430499999922176,
        [87] = 0.003424099999847385,
        [88] = 0.003439800000023752,
        [89] = 0.003427799999826675,
        [90] = 0.003429200000027777,
        [91] = 0.003422600000021703,
        [92] = 0.003439200000002529,
        [93] = 0.003434500000139451,
        [94] = 0.003423099999963597,
        [95] = 0.003429500000038388,
        [96] = 0.003426900000022215,
        [97] = 0.003438299999970695,
        [98] = 0.003435200000012628,
        [99] = 0.003431299999874682,
        [100] = 0.003425700000207144,
        [101] = 0.003437900000108129
    }
}
Fastest:
{
    ["Fastest"] = "First",
    ["Average time"] = 0.001903594059400564
}
1 Like

Hey guys, there is something wierd happening with my script, roblox says it can’t parse json but the jason format is correct and i used the same scripts from before. Is this a roblox problem or did i do something wrong

Hello buddy! That’s fantastic news! It’s always great to see innovative features being developed on Roblox. Keep up the good work! :cool:

Interesting, never would’ve thought about this.

Wow! That’s insane! How did you managed to display the screen in Roblox? Is it using Gui frames?

I haven’t tested it myself but I got some information from a friend who created a similar thing, he said that parts were faster, but later on I looked on other things I could use like one sided plane which has 2 triangles instead of a cube (part) which has 12 triangles

Creating mesh parts is much more unoptimized than creating parts since you need to use :Clone() instead of Instance.new() which is a lot laggier due to it copying every single property

1 Like

Ah, I see! So using a plane mesh would be a good way of doing it if you could use Instance.new() but since you can’t, parts are better?

yes and no, for making the screen the first time instance.new would be faster but after that it does not matter

Ah I see so after that all you would need to do is change the colour of the meshes?

well skipping the python side and all the encoding and decoding then yes

1 Like

I’m not very familiar with this vocabulary but, what is a plane mesh and where can I get one or how could I create one?


It is a 3D object that has 4 vertices, it is visible from only one side

the reason I’m using it is due to it having 4 vertices or 4 points, while a cube would have 8 vertices which is double the amount.

If you want to have this you can make it easily in any 3D modeling service such as blender, oooor download it here :smiley:
plane.fbx (11.3 KB)

1 Like