-
What do you want to achieve? making a fully working part that streams my screen and displays it
-
What is the issue? it works fine in roblox studio but errors on roblox server
-
What solutions have you tried so far? looked everywhere, to be honest,
When I run my game on a normal roblox server the part doesn’t seem to make pixels because it declined the request coming from localhost 1111.
roblox development server:
roblox server:
idk why this happens but i think roblox blacklisted localhost 1111 from accessing vs code.
script:
http = game:GetService("HttpService")
function GetPixels()
local message = "request pixels"
http:PostAsync("http://localhost:1111/test", message,Enum.HttpContentType.ApplicationUrlEncoded)
local data = http:GetAsync("http://localhost:1111/test")
return http:JSONDecode(data)
end
function ClearPixels()
for index, pixel in ipairs(game.Workspace.Screen.SurfaceGui:GetChildren()) do
if pixel.Name == "Clone" then
pixel:Destroy()
end
end
end
function MakePixels()
local pixels = {game.Workspace.Screen.SurfaceGui.Frame}
local colors = GetPixels()
local dataIndex = 1
ClearPixels()
for y = 1, 101, 1 do
for x = 1, 100, 1 do
local pixel = pixels[#pixels]:Clone()
pixel.Name = "Clone"
pixel.Parent = game.Workspace.Screen.SurfaceGui
pixel.Position = UDim2.new(pixel.Position.X.Scale + 0.01, 0, pixel.Position.Y.Scale, 0)
pixel.BorderColor3 = Color3.fromRGB(tonumber(colors[dataIndex][1]), tonumber(colors[dataIndex][2]), tonumber(colors[dataIndex][3]))
table.insert(pixels, pixel)
dataIndex += 1
end
local pixel = pixels[#pixels]:Clone()
pixel.Name = "Clone"
pixel.Parent = game.Workspace.Screen.SurfaceGui
pixel.Position = UDim2.new(pixels[1].Position.X.Scale, 0, pixel.Position.Y.Scale + 0.01, 0)
pixel.BorderColor3 = Color3.fromRGB(tonumber(colors[dataIndex][1]), tonumber(colors[dataIndex][2]), tonumber(colors[dataIndex][3]))
table.insert(pixels, pixel)
dataIndex += 1
end
end
while true do
MakePixels()
end
python code:
from flask import Flask, render_template, request
import PIL
import os
import pyautogui
import time
from math import sqrt
value = sqrt(50)
newlist = [i**2 for i in range(1, 100) if i%2==0]
newlist = []
for word in "wordlist":
newlist.append(word.upper())
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/test', methods=['POST', 'GET'])
def test():
if request.method == 'GET':
data = str(GetPixelColors())
return data
return render_template('index.html')
def GetPixelColors():
colors = []
screenshot = pyautogui.screenshot()
screenshot.save("ss.png")
img = PIL.Image.open("ss.png")
img = img.resize((101, 102))
img.show
pixels = img.load()
for y in range(102):
for x in range(101):
color = []
color.insert(0, pixels[x, y][0])
color.insert(1, pixels[x, y][1])
color.insert(2, pixels[x, y][2])
colors.insert(len(colors)-1, color)
os.remove("ss.png")
return colors
#print(GetPixelColors())
app.run(host='0.0.0.0',port='1111',debug=False)
any thoughts or solutions?