-
Notifications
You must be signed in to change notification settings - Fork 0
/
vscode.lua
45 lines (34 loc) · 1.04 KB
/
vscode.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
spawn(function()
repeat task.wait() until game:IsLoaded()
local lp = game.Players.LocalPlayer
local SMethod = (WebSocket and WebSocket.connect)
if not SMethod then return lp:Kick("Executor is too shitty.") end
local Main = function()
WebSocket = SMethod("ws://localhost:9000/")
local Closed = false
if not WebSocket then return end
WebSocket:Send(game.HttpService:JSONEncode({
Method= "Authorization",
Name= lp.Name
}))
WebSocket.OnMessage:Connect(function(Unparsed)
local Parsed= game.HttpService:JSONDecode(Unparsed)
if (Parsed.Method == "Execute") then
local FFunction, Error= loadstring(Parsed.Data)
if Error then return WebSocket:Send(game.HttpService:JSONEncode({
Method= "Error",
Message= Error
}))end
spawn(FFunction)
end
end)
WebSocket.OnClose:Connect(function()
Closed= true
end)
repeat task.wait() until Closed
end
while task.wait(1) do
local Success, Error = pcall(Main)
if not Success then warn("websocket fail") return end
end
end)