-- Xcw7x Chat v16 | Midnight Indigo local P,TS,SS,UIS,HS=game:GetService("Players"),game:GetService("TweenService"),game:GetService("SoundService"),game:GetService("UserInputService"),game:GetService("HttpService") local LP=P.LocalPlayer local req=(http and http.request) or http_request or request or (syn and syn.request) if not req then return end local C={bg=Color3.fromRGB(17,19,26),panel=Color3.fromRGB(25,28,38),btn=Color3.fromRGB(37,41,56),accent=Color3.fromRGB(129,140,248),text=Color3.fromRGB(232,234,246),sub=Color3.fromRGB(148,153,175)} local HEX,F,FB,LF="#818CF8",Enum.Font.BuilderSans,Enum.Font.BuilderSansBold,Enum.TextXAlignment.Left local SID=game.JobId~="" and game.JobId or "GlobalLobby" local last=0 local TOPIC="xcw7x-k9Qm4vT2zLp8Rn6Wd3Yh" -- اسم الغرفة: غيّره لأي اسم طويل عشوائي (تعطيه بس لخوك) local ONLYSERVER=false -- true = نفس سيرفر اللعبة فقط local BASE="ntfy.sh/"..TOPIC..(ONLYSERVER and "-"..SID or "") local seen,mine={},{} local function N(c,p,par,r,s) local o=Instance.new(c) if o:IsA("GuiObject") then o.BorderSizePixel=0 end for k,v in pairs(p) do o[k]=v end if r then Instance.new("UICorner",o).CornerRadius=UDim.new(0,r) end if s then local u=Instance.new("UIStroke",o) u.ApplyStrokeMode=Enum.ApplyStrokeMode.Border u.Color,u.Transparency,u.Thickness=s[1],s[2] or 0,1 end o.Parent=par return o end local function esc(s) return (s:gsub("&","&"):gsub("<","<"):gsub(">",">")) end local function cp(t) local f=setclipboard or toclipboard or set_clipboard or (syn and syn.write_clipboard) if f then pcall(f,tostring(t)) end end local function snd(id,v) task.spawn(function() local s=N("Sound",{SoundId="rbxassetid://"..id,Volume=v or .4},SS) s:Play() game:GetService("Debris"):AddItem(s,5) end) end local host=(gethui and gethui()) or LP:WaitForChild("PlayerGui") local old=host:FindFirstChild("Xcw7xChat") if old then old:Destroy() end local G=N("ScreenGui",{Name="Xcw7xChat",ResetOnSpawn=false,DisplayOrder=100},host) -- Top buttons local TB=N("TextButton",{Position=UDim2.new(1,-165,0,10),Size=UDim2.new(0,155,0,28),BackgroundColor3=C.panel,Text="Xcw7x Chat v16",TextColor3=C.accent,Font=FB,TextSize=12},G,8,{C.btn}) local QB=N("Frame",{Position=UDim2.new(1,-165,0,42),Size=UDim2.new(0,155,0,26),BackgroundColor3=C.bg},G,6,{C.btn}) local QI=N("TextBox",{Position=UDim2.new(0,6,0,0),Size=UDim2.new(1,-12,1,0),BackgroundTransparency=1,PlaceholderText="رسالة سريعة...",PlaceholderColor3=C.sub,Text="",TextColor3=C.text,TextSize=11,Font=F,ClearTextOnFocus=false},QB) -- Main window local M=N("Frame",{AnchorPoint=Vector2.new(.5,.5),Position=UDim2.new(.5,0,.45,0),Size=UDim2.new(0,360,0,270),BackgroundColor3=C.bg,Active=true},G,12,{C.accent,.6}) local T=N("TextLabel",{Position=UDim2.new(0,6,0,6),Size=UDim2.new(1,-12,0,30),BackgroundColor3=C.panel,Text=" Xcw7x Chat",TextColor3=C.text,TextSize=13,Font=FB,TextXAlignment=LF},M,8) local CB=N("TextButton",{Position=UDim2.new(1,-56,0,4),Size=UDim2.new(0,50,0,22),BackgroundColor3=C.btn,Text="مسح",TextColor3=C.text,Font=FB,TextSize=10},T,6,{C.accent,.6}) local S=N("ScrollingFrame",{Position=UDim2.new(0,8,0,42),Size=UDim2.new(1,-16,1,-94),BackgroundTransparency=1,CanvasSize=UDim2.new(),AutomaticCanvasSize=Enum.AutomaticSize.Y,ScrollBarThickness=3,ScrollBarImageColor3=C.accent},M) N("UIListLayout",{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder},S) local IF=N("Frame",{Position=UDim2.new(0,8,1,-46),Size=UDim2.new(1,-16,0,36),BackgroundColor3=C.panel},M,8,{C.btn}) local MI=N("TextBox",{Position=UDim2.new(0,10,0,0),Size=UDim2.new(1,-72,1,0),BackgroundTransparency=1,PlaceholderText="اكتب رسالة...",PlaceholderColor3=C.sub,Text="",TextColor3=C.text,Font=FB,TextSize=12,ClearTextOnFocus=false,TextXAlignment=LF},IF) local SB=N("TextButton",{Position=UDim2.new(1,-58,0,5),Size=UDim2.new(0,52,0,26),BackgroundColor3=C.accent,Text="إرسال",TextColor3=C.bg,Font=FB,TextSize=11},IF,6) -- Notifications + typing local PH=N("Frame",{Position=UDim2.new(0,15,0,15),Size=UDim2.new(0,260,0,200),BackgroundTransparency=1},G) N("UIListLayout",{Padding=UDim.new(0,6)},PH) local TN=N("TextLabel",{Position=UDim2.new(0,15,0,225),Size=UDim2.new(0,150,0,28),BackgroundColor3=C.panel,Text="✍ أنت تكتب...",TextColor3=C.accent,Font=FB,TextSize=11,Visible=false},G,8,{C.accent,.5}) -- Drag (mouse + touch) local d,ds,sp local function ok(i) return i.UserInputType==Enum.UserInputType.MouseButton1 or i.UserInputType==Enum.UserInputType.Touch end T.InputBegan:Connect(function(i) if ok(i) then d,ds,sp=true,i.Position,M.Position end end) UIS.InputChanged:Connect(function(i) if d and (i.UserInputType==Enum.UserInputType.MouseMovement or i.UserInputType==Enum.UserInputType.Touch) then local x=i.Position-ds M.Position=UDim2.new(sp.X.Scale,sp.X.Offset+x.X,sp.Y.Scale,sp.Y.Offset+x.Y) end end) UIS.InputEnded:Connect(function(i) if ok(i) then d=false end end) -- Overhead bubble local function bubble(name,text) local pl=P:FindFirstChild(name) if not pl then for _,p in ipairs(P:GetPlayers()) do if p.DisplayName==name then pl=p break end end end local h=pl and pl.Character and pl.Character:FindFirstChild("Head") if not h then return end local o=h:FindFirstChild("XBubble") if o then o:Destroy() end local b=N("BillboardGui",{Name="XBubble",Adornee=h,Size=UDim2.new(0,180,0,40),StudsOffset=Vector3.new(0,2.5,0),AlwaysOnTop=true},h) local f=N("Frame",{Size=UDim2.new(1,0,1,0),BackgroundColor3=C.panel},b,8,{C.accent,.3}) N("TextLabel",{Position=UDim2.new(0,6,0,4),Size=UDim2.new(1,-12,1,-8),BackgroundTransparency=1,Text=text,TextColor3=C.text,Font=FB,TextSize=11,TextWrapped=true},f) task.delay(6,function() b:Destroy() end) end -- Popup notification (fades as one piece) local function notify(name,uid,text) snd(6732683428,.4) local n=N("CanvasGroup",{Size=UDim2.new(1,0,0,48),BackgroundColor3=C.panel},PH,8,{C.accent,.4}) N("ImageLabel",{Position=UDim2.new(0,6,0,6),Size=UDim2.new(0,36,0,36),BackgroundTransparency=1,Image="rbxthumb://type=AvatarHeadShot&id="..tostring(uid or 1).."&w=150&h=150"},n,18) N("TextLabel",{Position=UDim2.new(0,50,0,6),Size=UDim2.new(1,-56,0,16),BackgroundTransparency=1,Text=name,TextColor3=C.accent,Font=FB,TextSize=12,TextXAlignment=LF},n) N("TextLabel",{Position=UDim2.new(0,50,0,24),Size=UDim2.new(1,-56,0,18),BackgroundTransparency=1,Text=text,TextColor3=C.text,Font=F,TextSize=11,TextXAlignment=LF,TextTruncate=Enum.TextTruncate.AtEnd},n) task.delay(4,function() TS:Create(n,TweenInfo.new(.4),{GroupTransparency=1}):Play() task.wait(.4) n:Destroy() end) end -- Chat message local function addMsg(name,text,sys) local f=N("Frame",{Size=UDim2.new(1,-4,0,0),AutomaticSize=Enum.AutomaticSize.Y,BackgroundColor3=C.panel,BackgroundTransparency=sys and 1 or 0},S,6) N("UIPadding",{PaddingTop=UDim.new(0,5),PaddingBottom=UDim.new(0,5),PaddingLeft=UDim.new(0,7),PaddingRight=UDim.new(0,7)},f) N("TextLabel",{Size=UDim2.new(1,sys and 0 or -44,0,0),AutomaticSize=Enum.AutomaticSize.Y,BackgroundTransparency=1,RichText=true,TextColor3=C.text,Font=F,TextSize=12,TextWrapped=true,TextXAlignment=LF, Text=sys and ("[نظام] "..esc(text).."") or (""..esc(name)..": "..esc(text))},f) if not sys then local b=N("TextButton",{AnchorPoint=Vector2.new(1,0),Position=UDim2.new(1,0,0,0),Size=UDim2.new(0,38,0,18),BackgroundColor3=C.btn,Text="نسخ",TextColor3=C.sub,Font=FB,TextSize=9},f,4) b.MouseButton1Click:Connect(function() snd(9114223179,.2) cp(text) b.Text="تم!" task.delay(1.2,function() b.Text="نسخ" end) end) end local fs={} for _,c in ipairs(S:GetChildren()) do if c:IsA("Frame") then fs[#fs+1]=c end end if #fs>60 then fs[1]:Destroy() end task.delay(.05,function() S.CanvasPosition=Vector2.new(0,1e6) end) end local function send(t,sys) if not sys then t=(t or ""):match("^%s*(.-)%s*$"):sub(1,200) if t=="" or tick()-last<.8 then return end end last=tick() snd(4612375269,.4) local name=LP.DisplayName or LP.Name TN.Visible=false addMsg(name,t,sys) if not sys then bubble(name,t) notify(name,LP.UserId,t) end local id=os.time().."_"..math.random(1000,9999) mine[id]=true task.spawn(pcall,function() req({Url="https://"..BASE,Method="POST",Headers={["Content-Type"]="text/plain; charset=utf-8"}, Body=HS:JSONEncode({id=id,sender=name,userId=LP.UserId,text=t,isSystem=sys or false})}) end) end local function typ() TN.Visible=#MI.Text>0 or #QI.Text>0 end MI:GetPropertyChangedSignal("Text"):Connect(typ) QI:GetPropertyChangedSignal("Text"):Connect(typ) MI.FocusLost:Connect(function(e) if e then send(MI.Text) MI.Text="" end end) QI.FocusLost:Connect(function(e) if e then send(QI.Text) QI.Text="" end end) SB.MouseButton1Click:Connect(function() send(MI.Text) MI.Text="" end) CB.MouseButton1Click:Connect(function() snd(9114223179,.3) for _,c in ipairs(S:GetChildren()) do if c:IsA("Frame") then c:Destroy() end end end) TB.MouseButton1Click:Connect(function() snd(9114223179,.3) M.Visible=not M.Visible end) -- استقبال (WebSocket لحظي، وإذا المشغل ما يدعمه يستخدم polling) local function handle(raw) local ok,e=pcall(HS.JSONDecode,HS,raw) if not ok or type(e)~="table" or e.event~="message" or seen[e.id] then return end seen[e.id]=true local ok2,m=pcall(HS.JSONDecode,HS,tostring(e.message)) if not ok2 or type(m)~="table" or mine[m.id] then return end local sn,tx=tostring(m.sender or "?"),tostring(m.text or ""):sub(1,200) addMsg(sn,tx,m.isSystem) if not m.isSystem and (tonumber(e.time) or 0)>os.time()-15 then bubble(sn,tx) notify(sn,m.userId,tx) end end local WSC=(WebSocket and WebSocket.connect) or (syn and syn.websocket and syn.websocket.connect) local function poll() local since="30m" while G.Parent do local ok,r=pcall(req,{Url="https://"..BASE.."/json?poll=1&since="..since,Method="GET"}) if ok and r and r.Body then for l in r.Body:gmatch("[^\n]+") do handle(l) local o,e=pcall(HS.JSONDecode,HS,l) if o and type(e)=="table" and e.id then since=e.id end end end task.wait(5) end end task.spawn(function() local fails=0 while G.Parent and WSC and fails<3 do local ok,ws=pcall(WSC,"wss://"..BASE.."/ws?since=30m") if ok and ws then fails=0 local closed=false ws.OnMessage:Connect(handle) ws.OnClose:Connect(function() closed=true end) repeat task.wait(1) until closed or not G.Parent else fails+=1 end task.wait(3) end if G.Parent then poll() end end) task.delay(.5,function() send("انضم "..(LP.DisplayName or LP.Name).." إلى المحادثة",true) end)