-- since i abandoned lua completely and switched to javascript, i vibdecoded it local Players = game:GetService("Players") local HttpService = game:GetService("HttpService") local Player = Players.LocalPlayer local Username = Player.Name local ROOM = "REX-Chat" local PASSWORD = "6xrxDelnel7@/:.4!" local ENDPOINT = "wss://chatroom.openfun.app/ws" -- Connect to OpenFun local Socket = WebSocket.connect(ENDPOINT) -- GUI setup local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "ZDChatGUI" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = game:GetService("CoreGui") -- Main window local Main = Instance.new("Frame") Main.Name = "Main" Main.Size = UDim2.new(0, 400, 0, 350) Main.Position = UDim2.new(0.5, -200, 0.5, -175) Main.BackgroundColor3 = Color3.fromRGB(30, 30, 35) Main.BorderSizePixel = 0 Main.Parent = ScreenGui local MainCorner = Instance.new("UICorner") MainCorner.CornerRadius = UDim.new(0, 8) MainCorner.Parent = Main -- Built-in drag detector local DragDetector = Instance.new("UIDragDetector") DragDetector.Parent = Main -- Title bar local TitleBar = Instance.new("Frame") TitleBar.Name = "TitleBar" TitleBar.Size = UDim2.new(1, 0, 0, 38) TitleBar.BackgroundColor3 = Color3.fromRGB(45, 45, 55) TitleBar.BorderSizePixel = 0 TitleBar.Parent = Main local TitleCorner = Instance.new("UICorner") TitleCorner.CornerRadius = UDim.new(0, 8) TitleCorner.Parent = TitleBar local Title = Instance.new("TextLabel") Title.Size = UDim2.new(1, -20, 1, 0) Title.Position = UDim2.new(0, 10, 0, 0) Title.BackgroundTransparency = 1 Title.Text = "REX-Chat | " .. Username Title.TextColor3 = Color3.fromRGB(255, 255, 255) Title.TextSize = 16 Title.Font = Enum.Font.GothamBold Title.TextXAlignment = Enum.TextXAlignment.Left Title.Parent = TitleBar -- Messages panel local Messages = Instance.new("ScrollingFrame") Messages.Name = "Messages" Messages.Position = UDim2.new(0, 10, 0, 48) Messages.Size = UDim2.new(1, -20, 1, -108) Messages.BackgroundColor3 = Color3.fromRGB(22, 22, 26) Messages.BorderSizePixel = 0 Messages.ScrollBarThickness = 5 Messages.CanvasSize = UDim2.new(0, 0, 0, 0) Messages.AutomaticCanvasSize = Enum.AutomaticSize.Y Messages.Parent = Main local MessagesCorner = Instance.new("UICorner") MessagesCorner.CornerRadius = UDim.new(0, 6) MessagesCorner.Parent = Messages local MessageLayout = Instance.new("UIListLayout") MessageLayout.Padding = UDim.new(0, 5) MessageLayout.SortOrder = Enum.SortOrder.LayoutOrder MessageLayout.Parent = Messages local MessagePadding = Instance.new("UIPadding") MessagePadding.PaddingTop = UDim.new(0, 8) MessagePadding.PaddingBottom = UDim.new(0, 8) MessagePadding.PaddingLeft = UDim.new(0, 8) MessagePadding.PaddingRight = UDim.new(0, 8) MessagePadding.Parent = Messages -- Add a message to the GUI local function AddMessage(Text) local Label = Instance.new("TextLabel") Label.BackgroundTransparency = 1 Label.Size = UDim2.new(1, -4, 0, 22) Label.AutomaticSize = Enum.AutomaticSize.Y Label.Text = tostring(Text) Label.TextColor3 = Color3.fromRGB(230, 230, 230) Label.TextSize = 14 Label.Font = Enum.Font.Gotham Label.TextXAlignment = Enum.TextXAlignment.Left Label.TextWrapped = true Label.Parent = Messages task.defer(function() Messages.CanvasPosition = Vector2.new( 0, math.max( 0, Messages.AbsoluteCanvasSize.Y - Messages.AbsoluteSize.Y ) ) end) end -- Message input local Input = Instance.new("TextBox") Input.Name = "Input" Input.Position = UDim2.new(0, 10, 1, -50) Input.Size = UDim2.new(1, -100, 0, 40) Input.BackgroundColor3 = Color3.fromRGB(45, 45, 52) Input.BorderSizePixel = 0 Input.PlaceholderText = "Type a message..." Input.Text = "" Input.TextColor3 = Color3.fromRGB(255, 255, 255) Input.PlaceholderColor3 = Color3.fromRGB(170, 170, 170) Input.TextSize = 14 Input.Font = Enum.Font.Gotham Input.ClearTextOnFocus = false Input.Parent = Main local InputCorner = Instance.new("UICorner") InputCorner.CornerRadius = UDim.new(0, 6) InputCorner.Parent = Input -- Send button local SendButton = Instance.new("TextButton") SendButton.Name = "Send" SendButton.Position = UDim2.new(1, -80, 1, -50) SendButton.Size = UDim2.new(0, 70, 0, 40) SendButton.BackgroundColor3 = Color3.fromRGB(65, 120, 220) SendButton.BorderSizePixel = 0 SendButton.Text = "Send" SendButton.TextColor3 = Color3.fromRGB(255, 255, 255) SendButton.TextSize = 14 SendButton.Font = Enum.Font.GothamBold SendButton.Parent = Main local SendCorner = Instance.new("UICorner") SendCorner.CornerRadius = UDim.new(0, 6) SendCorner.Parent = SendButton -- Send a chat message using OpenFun's protocol local function SendMessage() local Message = Input.Text if not Message:match("%S") then return end if #Message > 100 then AddMessage("(S) Messages must be 100 characters or fewer.") return end local Success = pcall(function() Socket:Send(HttpService:JSONEncode({ type = "say", payload = { type = "chat", text = Message } })) end) if Success then Input.Text = "" else AddMessage("(S) Failed to send message.") end end SendButton.MouseButton1Click:Connect(SendMessage) Input.FocusLost:Connect(function(EnterPressed) if EnterPressed then SendMessage() end end) -- Receive OpenFun events Socket.OnMessage:Connect(function(RawMessage) local Success, Data = pcall(function() return HttpService:JSONDecode(tostring(RawMessage)) end) if not Success or type(Data) ~= "table" then return end if Data.type == "joined" then Title.Text = "REX-Chat | " .. Username AddMessage("(S) Joined room: " .. tostring(Data.room)) -- Display recent chat history if type(Data.history) == "table" then for _, Entry in ipairs(Data.history) do local Payload = Entry.payload if type(Payload) == "table" and Payload.type == "chat" and type(Payload.text) == "string" then AddMessage( tostring(Entry.username) .. ": " .. Payload.text ) end end end elseif Data.type == "say" then local Payload = Data.payload if type(Payload) == "table" and Payload.type == "chat" and type(Payload.text) == "string" then AddMessage( tostring(Data.username) .. ": " .. Payload.text ) end elseif Data.type == "user-joined" then AddMessage("(S) " .. tostring(Data.username) .. " joined the room.") elseif Data.type == "user-left" then AddMessage("(S) " .. tostring(Data.username) .. " left the room.") elseif Data.type == "error" then AddMessage( "(S) " .. tostring(Data.code) .. ": " .. tostring(Data.message) ) end end) Socket.OnClose:Connect(function() AddMessage("(S) Disconnected from OpenFun.") end) -- Join the password-protected room local JoinSuccess, JoinError = pcall(function() Socket:Send(HttpService:JSONEncode({ type = "join", room = ROOM, username = Username, password = PASSWORD })) end) if JoinSuccess then AddMessage("(S) Connecting to " .. ROOM .. "...") else AddMessage("(S) Failed to send join request: " .. tostring(JoinError)) end