Ro chat
Key RequiredUniversal

Ro chat

Universal ScriptMohamedzzxeMohamedzzxe 734 views 4.4K executesUpdated Sep 11, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•682 lines (24142 chars)
-- RO Chat All Map & Floating Notifications by Clark
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextChatService = game:GetService("TextChatService")
local MessagingService = game:GetService("MessagingService")

local playerGui = localPlayer:WaitForChild("PlayerGui")
if playerGui:FindFirstChild("ROChatAllMap") then
    playerGui.ROChatAllMap:Destroy()
end

-- إنشاء الواجهة الرئيسية
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "ROChatAllMap"
ScreenGui.Parent = playerGui
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.ResetOnSpawn = false
ScreenGui.DisplayOrder = 999

-- إطار إشعارات الزاوية السفلية (عندما يكون السكربت مغلقاً أو مفتوحاً)
local NotifContainer = Instance.new("Frame")
NotifContainer.Name = "NotifContainer"
NotifContainer.Parent = ScreenGui
NotifContainer.BackgroundTransparency = 1
NotifContainer.Position = UDim2.new(0.01, 0, 0.70, 0)
NotifContainer.Size = UDim2.new(0, 260, 0, 120)
NotifContainer.ZIndex = 50

local NotifLayout = Instance.new("UIListLayout")
NotifLayout.Parent = NotifContainer
NotifLayout.SortOrder = Enum.SortOrder.LayoutOrder
NotifLayout.VerticalAlignment = Enum.VerticalAlignment.Bottom
NotifLayout.Padding = UDim.new(0, 5)

-- الأيقونة العائمة (كوكب زحل)
local ToggleButton = Instance.new("TextButton")
ToggleButton.Name = "ToggleButton"
ToggleButton.Parent = ScreenGui
ToggleButton.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
ToggleButton.BackgroundTransparency = 0.2
ToggleButton.BorderSizePixel = 0
ToggleButton.Position = UDim2.new(0.01, 0, 0.35, 0)
ToggleButton.Size = UDim2.new(0, 48, 0, 48)
ToggleButton.Font = Enum.Font.SourceSansBold
ToggleButton.Text = "🪐"
ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleButton.TextSize = 24
ToggleButton.Active = true
ToggleButton.Draggable = true
ToggleButton.ZIndex = 20

local UICornerBtn = Instance.new("UICorner")
UICornerBtn.CornerRadius = UDim.new(1, 0)
UICornerBtn.Parent = ToggleButton

local UIStrokeBtn = Instance.new("UIStroke")
UIStrokeBtn.Parent = ToggleButton
UIStrokeBtn.Thickness = 2
UIStrokeBtn.Color = Color3.fromRGB(0, 170, 255)

-- إطار الشات الرئيسي
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Parent = ScreenGui
MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
MainFrame.BackgroundTransparency = 0.1
MainFrame.BorderSizePixel = 0
MainFrame.Position = UDim2.new(0.06, 0, 0.3, 0)
MainFrame.Size = UDim2.new(0, 310, 0, 340)
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.ZIndex = 10

local UICornerMain = Instance.new("UICorner")
UICornerMain.CornerRadius = UDim.new(0, 8)
UICornerMain.Parent = MainFrame

local UIStroke = Instance.new("UIStroke")
UIStroke.Parent = MainFrame
UIStroke.Thickness = 2
UIStroke.Color = Color3.fromRGB(0, 255, 100)

-- شريط العنوان
local TitleBar = Instance.new("TextLabel")
TitleBar.Name = "TitleBar"
TitleBar.Parent = MainFrame
TitleBar.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
TitleBar.BorderSizePixel = 0
TitleBar.Size = UDim2.new(1, 0, 0, 30)
TitleBar.Font = Enum.Font.SourceSansBold
TitleBar.Text = "  RO Chat - All Map"
TitleBar.TextColor3 = Color3.fromRGB(255, 255, 255)
TitleBar.TextSize = 14
TitleBar.TextXAlignment = Enum.TextXAlignment.Left
TitleBar.ZIndex = 11

local UICornerTitle = Instance.new("UICorner")
UICornerTitle.CornerRadius = UDim.new(0, 8)
UICornerTitle.Parent = TitleBar

local ColorButton = Instance.new("TextButton")
ColorButton.Parent = TitleBar
ColorButton.BackgroundColor3 = Color3.fromRGB(0, 255, 100)
ColorButton.BorderSizePixel = 0
ColorButton.Position = UDim2.new(0.86, 0, 0.15, 0)
ColorButton.Size = UDim2.new(0, 20, 0, 20)
ColorButton.Text = ""
ColorButton.ZIndex = 12
local UICornerColor = Instance.new("UICorner")
UICornerColor.CornerRadius = UDim.new(1, 0)
UICornerColor.Parent = ColorButton

-- قسم البروفايل
local ProfileFrame = Instance.new("Frame")
ProfileFrame.Parent = MainFrame
ProfileFrame.BackgroundTransparency = 1
ProfileFrame.Position = UDim2.new(0.03, 0, 0.10, 0)
ProfileFrame.Size = UDim2.new(0.94, 0, 0, 45)
ProfileFrame.ZIndex = 11

local AvatarImg = Instance.new("ImageLabel")
AvatarImg.Parent = ProfileFrame
AvatarImg.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
AvatarImg.BorderSizePixel = 0
AvatarImg.Size = UDim2.new(0, 36, 0, 36)
AvatarImg.Position = UDim2.new(0, 0, 0, 0)
AvatarImg.ZIndex = 11
local success, thumb = pcall(function()
    return Players:GetUserThumbnailAsync(localPlayer.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size42x42)
end)
AvatarImg.Image = success and thumb or ""
local UICornerAvatar = Instance.new("UICorner")
UICornerAvatar.CornerRadius = UDim.new(1, 0)
UICornerAvatar.Parent = AvatarImg

local ProfileText = Instance.new("TextLabel")
ProfileText.Parent = ProfileFrame
ProfileText.Name = "ProfileText"
ProfileText.BackgroundTransparency = 1
ProfileText.Position = UDim2.new(0, 45, 0, 0)
ProfileText.Size = UDim2.new(1, -45, 1, 0)
ProfileText.Font = Enum.Font.SourceSansBold
ProfileText.Text = "المطور Clark | محمد\n📱 تيك توك: roro.mm454"
ProfileText.TextColor3 = Color3.fromRGB(255, 0, 0)
ProfileText.TextSize = 11
ProfileText.TextXAlignment = Enum.TextXAlignment.Left
ProfileText.ZIndex = 11

local RightsLabel = Instance.new("TextLabel")
RightsLabel.Parent = MainFrame
RightsLabel.BackgroundTransparency = 1
RightsLabel.Position = UDim2.new(0.03, 0, 0.94, 0)
RightsLabel.Size = UDim2.new(0.94, 0, 0, 15)
RightsLabel.Font = Enum.Font.SourceSans
RightsLabel.Text = "By Clark © All Rights Reserved"
RightsLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
RightsLabel.TextSize = 10
RightsLabel.TextXAlignment = Enum.TextXAlignment.Center
RightsLabel.ZIndex = 11

-- أزرار التابات
local TabGlobalBtn = Instance.new("TextButton")
TabGlobalBtn.Name = "TabGlobalBtn"
TabGlobalBtn.Parent = MainFrame
TabGlobalBtn.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
TabGlobalBtn.BorderSizePixel = 0
TabGlobalBtn.Position = UDim2.new(0.03, 0, 0.23, 0)
TabGlobalBtn.Size = UDim2.new(0.45, 0, 0, 22)
TabGlobalBtn.Font = Enum.Font.SourceSansBold
TabGlobalBtn.Text = "🌍 شات السيرفر العام"
TabGlobalBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
TabGlobalBtn.TextSize = 11
TabGlobalBtn.ZIndex = 11
local UICornerTg = Instance.new("UICorner")
UICornerTg.CornerRadius = UDim.new(0, 5)
UICornerTg.Parent = TabGlobalBtn

local TabPrivateBtn = Instance.new("TextButton")
TabPrivateBtn.Name = "TabPrivateBtn"
TabPrivateBtn.Parent = MainFrame
TabPrivateBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
TabPrivateBtn.BorderSizePixel = 0
TabPrivateBtn.Position = UDim2.new(0.52, 0, 0.23, 0)
TabPrivateBtn.Size = UDim2.new(0.45, 0, 0, 22)
TabPrivateBtn.Font = Enum.Font.SourceSansBold
TabPrivateBtn.Text = "🔒 الشات الخاص"
TabPrivateBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
TabPrivateBtn.TextSize = 11
TabPrivateBtn.ZIndex = 11
local UICornerPr = Instance.new("UICorner")
UICornerPr.CornerRadius = UDim.new(0, 5)
UICornerPr.Parent = TabPrivateBtn

-- صندوق رسائل العام
local ChatScroll = Instance.new("ScrollingFrame")
ChatScroll.Name = "ChatScroll"
ChatScroll.Parent = MainFrame
ChatScroll.Active = true
ChatScroll.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
ChatScroll.BackgroundTransparency = 0.3
ChatScroll.BorderSizePixel = 0
ChatScroll.Position = UDim2.new(0.03, 0, 0.31, 0)
ChatScroll.Size = UDim2.new(0.94, 0, 0.33, 0)
ChatScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
ChatScroll.ScrollBarThickness = 4
ChatScroll.ZIndex = 11

local UIListLayout = Instance.new("UIListLayout")
UIListLayout.Parent = ChatScroll
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout.Padding = UDim.new(0, 4)

-- صندوق رسائل الخاص
local PrivateChatScroll = Instance.new("ScrollingFrame")
PrivateChatScroll.Name = "PrivateChatScroll"
PrivateChatScroll.Parent = MainFrame
PrivateChatScroll.Active = true
PrivateChatScroll.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
PrivateChatScroll.BackgroundTransparency = 0.3
PrivateChatScroll.BorderSizePixel = 0
PrivateChatScroll.Position = UDim2.new(0.03, 0, 0.31, 0)
PrivateChatScroll.Size = UDim2.new(0.94, 0, 0.33, 0)
PrivateChatScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
PrivateChatScroll.ScrollBarThickness = 4
PrivateChatScroll.Visible = false
PrivateChatScroll.ZIndex = 11

local UIListLayoutPr = Instance.new("UIListLayout")
UIListLayoutPr.Parent = PrivateChatScroll
UIListLayoutPr.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayoutPr.Padding = UDim.new(0, 4)

-- خانة الهدف للخاص
local TargetBox = Instance.new("TextBox")
TargetBox.Name = "TargetBox"
TargetBox.Parent = MainFrame
TargetBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
TargetBox.BorderSizePixel = 0
TargetBox.Position = UDim2.new(0.03, 0, 0.67, 0)
TargetBox.Size = UDim2.new(0.94, 0, 0, 25)
TargetBox.Font = Enum.Font.SourceSansBold
TargetBox.PlaceholderText = "اضغط على اسم أي شخص بالعام لاختياره..."
TargetBox.Text = ""
TargetBox.TextColor3 = Color3.fromRGB(255, 200, 0)
TargetBox.TextSize = 12
TargetBox.TextXAlignment = Enum.TextXAlignment.Left
TargetBox.Visible = false
TargetBox.ZIndex = 11
local UICornerTarget = Instance.new("UICorner")
UICornerTarget.CornerRadius = UDim.new(0, 6)
UICornerTarget.Parent = TargetBox

-- خانة اسمك
local NameBox = Instance.new("TextBox")
NameBox.Name = "NameBox"
NameBox.Parent = MainFrame
NameBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
NameBox.BorderSizePixel = 0
NameBox.Position = UDim2.new(0.03, 0, 0.67, 0)
NameBox.Size = UDim2.new(0.79, 0, 0, 25)
NameBox.Font = Enum.Font.SourceSansBold
NameBox.PlaceholderText = "اسمك المزخرف بالشات..."
NameBox.Text = "محمد"
NameBox.TextColor3 = Color3.fromRGB(0, 255, 100)
NameBox.TextSize = 12
NameBox.TextXAlignment = Enum.TextXAlignment.Left
NameBox.ZIndex = 11
local UICornerName = Instance.new("UICorner")
UICornerName.CornerRadius = UDim.new(0, 6)
UICornerName.Parent = NameBox

-- زر RGB للاسم
local NameRGBButton = Instance.new("TextButton")
NameRGBButton.Name = "NameRGBButton"
NameRGBButton.Parent = MainFrame
NameRGBButton.BackgroundColor3 = Color3.fromRGB(0, 255, 100)
NameRGBButton.BorderSizePixel = 0
NameRGBButton.Position = UDim2.new(0.84, 0, 0.67, 0)
NameRGBButton.Size = UDim2.new(0.13, 0, 0, 25)
NameRGBButton.Font = Enum.Font.SourceSansBold
NameRGBButton.Text = "RGB"
NameRGBButton.TextColor3 = Color3.fromRGB(0, 0, 0)
NameRGBButton.TextSize = 11
NameRGBButton.ZIndex = 11
local UICornerNameRGB = Instance.new("UICorner")
UICornerNameRGB.CornerRadius = UDim.new(0, 6)
UICornerNameRGB.Parent = NameRGBButton

-- خانة كتابة الرسالة
local TextBox = Instance.new("TextBox")
TextBox.Name = "TextBox"
TextBox.Parent = MainFrame
TextBox.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
TextBox.BorderSizePixel = 0
TextBox.Position = UDim2.new(0.03, 0, 0.79, 0)
TextBox.Size = UDim2.new(0.72, 0, 0, 30)
TextBox.Font = Enum.Font.SourceSans
TextBox.PlaceholderText = "اكتب رسالتك لكل السيرفر..."
TextBox.Text = ""
TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
TextBox.TextSize = 13
TextBox.TextXAlignment = Enum.TextXAlignment.Left
TextBox.ZIndex = 11
local UICornerBox = Instance.new("UICorner")
UICornerBox.CornerRadius = UDim.new(0, 6)
UICornerBox.Parent = TextBox

-- زر الإرسال
local SendButton = Instance.new("TextButton")
SendButton.Name = "SendButton"
SendButton.Parent = MainFrame
SendButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
SendButton.BorderSizePixel = 0
SendButton.Position = UDim2.new(0.77, 0, 0.79, 0)
SendButton.Size = UDim2.new(0.2, 0, 0, 30)
SendButton.Font = Enum.Font.SourceSansBold
SendButton.Text = "إرسال"
SendButton.TextColor3 = Color3.fromRGB(255, 255, 255)
SendButton.TextSize = 13
SendButton.ZIndex = 11
local UICornerSend = Instance.new("UICorner")
UICornerSend.CornerRadius = UDim.new(0, 6)
UICornerSend.Parent = SendButton

local currentTab = "Global"
local systemMessages = {}
local activeGlobalMessages = {}

-- دالة إظهار الإشعار بالزاوية (مثلاً: [فلان]: تعال محمد)
local function showToastNotification(senderName, messageText)
    local NotifItem = Instance.new("TextLabel")
    NotifItem.Parent = NotifContainer
    NotifItem.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
    NotifItem.BackgroundTransparency = 0.2
    NotifItem.BorderSizePixel = 0
    NotifItem.Size = UDim2.new(1, 0, 0, 35)
    NotifItem.Font = Enum.Font.SourceSansBold
    NotifItem.Text = " [" .. senderName .. "]: " .. messageText
    NotifItem.TextColor3 = Color3.fromRGB(0, 255, 150)
    NotifItem.TextSize = 13
    NotifItem.TextXAlignment = Enum.TextXAlignment.Left
    NotifItem.TextWrapped = true
    NotifItem.ZIndex = 51

    local notifCorner = Instance.new("UICorner")
    notifCorner.CornerRadius = UDim.new(0, 6)
    notifCorner.Parent = NotifItem

    local notifStroke = Instance.new("UIStroke")
    notifStroke.Parent = NotifItem
    notifStroke.Thickness = 1.5
    notifStroke.Color = Color3.fromRGB(0, 170, 255)

    -- اختفاء الإشعار تلقائياً بعد 4 ثواني
    task.delay(4, function()
        if NotifItem and NotifItem.Parent then
            NotifItem:Destroy()
        end
    end)
end

-- دالة إظهار فقاعة النص فوق رأس اللاعب
local function showHeadBubble(player, message)
    if not message or message == "" then return end
    if not player.Character or not player.Character:FindFirstChild("Head") then return end
    local head = player.Character.Head
    
    if head:FindFirstChild("ROChatBubble") then
        head.ROChatBubble:Destroy()
    end
    
    local billboard = Instance.new("BillboardGui")
    billboard.Name = "ROChatBubble"
    billboard.Parent = head
    billboard.Size = UDim2.new(0, 220, 0, 40)
    billboard.StudsOffset = Vector3.new(0, 2.7, 0)
    billboard.AlwaysOnTop = true
    
    local textLabel = Instance.new("TextLabel")
    textLabel.Parent = billboard
    textLabel.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
    textLabel.BackgroundTransparency = 0.2
    textLabel.Size = UDim2.new(1, 0, 1, 0)
    textLabel.Font = Enum.Font.SourceSansBold
    textLabel.Text = message  -- الكلمة وحدها بدقة
    textLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    textLabel.TextSize = 14
    textLabel.TextWrapped = true
    
    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 8)
    corner.Parent = textLabel
    
    task.delay(5, function()
        if billboard and billboard.Parent then
            billboard:Destroy()
        end
    end)
end

local function switchToPrivateTab(targetName)
    TargetBox.Text = targetName
    currentTab = "Private"
    TabPrivateBtn.BackgroundColor3 = Color3.fromRGB(255, 170, 0)
    TabPrivateBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
    TabGlobalBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
    TabGlobalBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
    
    ChatScroll.Visible = false
    PrivateChatScroll.Visible = true
    NameBox.Visible = false
    NameRGBButton.Visible = false
    TargetBox.Visible = true
    TextBox.PlaceholderText = "اكتب الرسالة الخاصة..."
end

local function addGlobalMessage(sender, message, isRgbDynamic, isSystem)
    local MsgContainer = Instance.new("Frame")
    MsgContainer.Parent = ChatScroll
    MsgContainer.BackgroundTransparency = 1
    MsgContainer.Size = UDim2.new(1, -5, 0, 20)
    MsgContainer.ZIndex = 11
    
    local NameBtn = Instance.new("TextButton")
    NameBtn.Parent = MsgContainer
    NameBtn.BackgroundTransparency = 1
    NameBtn.Position = UDim2.new(0, 0, 0, 0)
    NameBtn.Size = UDim2.new(0, 110, 1, 0)
    NameBtn.Font = Enum.Font.SourceSansBold
    NameBtn.Text = "[" .. sender .. "]:"
    NameBtn.TextColor3 = isSystem and Color3.fromRGB(255, 0, 0) or Color3.fromRGB(0, 255, 150)
    NameBtn.TextSize = 13
    NameBtn.TextXAlignment = Enum.TextXAlignment.Left
    NameBtn.ZIndex = 12
    
    local MsgLabel = Instance.new("TextLabel")
    MsgLabel.Parent = MsgContainer
    MsgLabel.BackgroundTransparency = 1
    MsgLabel.Position = UDim2.new(0, 115, 0, 0)
    MsgLabel.Size = UDim2.new(1, -115, 1, 0)
    MsgLabel.Font = Enum.Font.SourceSans
    MsgLabel.Text = message
    MsgLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    MsgLabel.TextSize = 13
    MsgLabel.TextXAlignment = Enum.TextXAlignment.Left
    MsgLabel.TextWrapped = true
    MsgLabel.ZIndex = 11

    if isRgbDynamic then
        table.insert(activeGlobalMessages, {label = NameBtn, msgLabel = MsgLabel})
    elseif isSystem then
        table.insert(systemMessages, NameBtn)
    end

    NameBtn.MouseButton1Click:Connect(function()
        if not isSystem then
            switchToPrivateTab(sender)
        end
    end)
    
    ChatScroll.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y + 10)
    ChatScroll.CanvasPosition = Vector2.new(0, ChatScroll.CanvasSize.Y.Offset)
end

local function addPrivateMessage(sender, receiver, message)
    local MsgContainer = Instance.new("Frame")
    MsgContainer.Parent = PrivateChatScroll
    MsgContainer.BackgroundTransparency = 1
    MsgContainer.Size = UDim2.new(1, -5, 0, 20)
    MsgContainer.ZIndex = 11
    
    local NameLabel = Instance.new("TextLabel")
    NameLabel.Parent = MsgContainer
    NameLabel.BackgroundTransparency = 1
    NameLabel.Position = UDim2.new(0, 0, 0, 0)
    NameLabel.Size = UDim2.new(0, 120, 1, 0)
    NameLabel.Font = Enum.Font.SourceSansBold
    NameLabel.Text = "[" .. sender .. " -> " .. receiver .. "]:"
    NameLabel.TextColor3 = Color3.fromRGB(255, 200, 0)
    NameLabel.TextSize = 13
    NameLabel.TextXAlignment = Enum.TextXAlignment.Left
    NameLabel.ZIndex = 11
    
    local MsgLabel = Instance.new("TextLabel")
    MsgLabel.Parent = MsgContainer
    MsgLabel.BackgroundTransparency = 1
    MsgLabel.Position = UDim2.new(0, 125, 0, 0)
    MsgLabel.Size = UDim2.new(1, -125, 1, 0)
    MsgLabel.Font = Enum.Font.SourceSans
    MsgLabel.Text = message
    MsgLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    MsgLabel.TextSize = 13
    MsgLabel.TextXAlignment = Enum.TextXAlignment.Left
    MsgLabel.TextWrapped = true
    MsgLabel.ZIndex = 11
    
    PrivateChatScroll.CanvasSize = UDim2.new(0, 0, 0, UIListLayoutPr.AbsoluteContentSize.Y + 10)
    PrivateChatScroll.CanvasPosition = Vector2.new(0, PrivateChatScroll.CanvasSize.Y.Offset)
end

-- استقبال ومعالجة الرسائل الواردة من جميع أنظمة الشات (القديم والحديث)
local function handleNewMessage(player, rawMsg)
    if not player or player == localPlayer then return end
    
    -- استخراج النص الصافي
    local cleanMsg = rawMsg
    local parsedName, parsedText = rawMsg:match("^%[(.-)%]:%s*(.*)$")
    if parsedText and parsedText ~= "" then
        cleanMsg = parsedText
    end
    
    if cleanMsg and cleanMsg ~= "" then
        addGlobalMessage(player.Name, cleanMsg, false, false)
        showHeadBubble(player, cleanMsg)
        showToastNotification(player.Name, cleanMsg) -- يظهر الإشعار أسفل الشاشة حتى لو السكربت مغلق!
    end
end

-- ربط أحداث الشات (دعم شامل لنظامي Roblox القديم والجديد TextChatService)
for _, p in ipairs(Players:GetPlayers()) do
    p.Chatted:Connect(function(msg)
        handleNewMessage(p, msg)
    end)
end

Players.PlayerAdded:Connect(function(p)
    p.Chatted:Connect(function(msg)
        handleNewMessage(p, msg)
    end)
end)

pcall(function()
    TextChatService.MessageReceived:Connect(function(textChatMessage)
        if textChatMessage.TextSource then
            local senderPlayer = Players:GetPlayerByUserId(textChatMessage.TextSource.UserId)
            if senderPlayer then
                handleNewMessage(senderPlayer, textChatMessage.Text)
            end
        end
    end)
end)

-- رسالة الترحيب للسيستم
addGlobalMessage("System", "نورت سكربتي يبعد عيوني ❤️", false, true)

TabGlobalBtn.MouseButton1Click:Connect(function()
    currentTab = "Global"
    TabGlobalBtn.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
    TabGlobalBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
    TabPrivateBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
    TabPrivateBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
    
    ChatScroll.Visible = true
    PrivateChatScroll.Visible = false
    NameBox.Visible = true
    NameRGBButton.Visible = true
    TargetBox.Visible = false
    TextBox.PlaceholderText = "اكتب رسالتك لكل السيرفر..."
end)

TabPrivateBtn.MouseButton1Click:Connect(function()
    currentTab = "Private"
    TabPrivateBtn.BackgroundColor3 = Color3.fromRGB(255, 170, 0)
    TabPrivateBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
    TabGlobalBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
    TabGlobalBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
    
    ChatScroll.Visible = false
    PrivateChatScroll.Visible = true
    NameBox.Visible = false
    NameRGBButton.Visible = false
    TargetBox.Visible = true
    TextBox.PlaceholderText = "اكتب الرسالة الخاصة..."
end)

local nameRgbActive = false
NameRGBButton.MouseButton1Click:Connect(function()
    nameRgbActive = not nameRgbActive
    if nameRgbActive then
        NameRGBButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    else
        NameRGBButton.TextColor3 = Color3.fromRGB(0, 0, 0)
        NameBox.TextColor3 = Color3.fromRGB(0, 255, 100)
    end
end)

local function sendMessage(txt)
    if txt ~= "" then
        if currentTab == "Global" then
            local currentName = NameBox.Text ~= "" and NameBox.Text or "محمد"
            local fullMsg = "[" .. currentName .. "]: " .. txt
            
            pcall(function()
                if TextChatService.ChatInputBarConfiguration.TargetTextChannel then
                    TextChatService.ChatInputBarConfiguration.TargetTextChannel:SendAsync(fullMsg)
                else
                    ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(fullMsg, "All")
                end
            end)
            
            addGlobalMessage(currentName, txt, nameRgbActive, false)
            showHeadBubble(localPlayer, txt)
        else
            local targetName = TargetBox.Text ~= "" and TargetBox.Text or "شخص ما"
            addPrivateMessage("محمد", targetName, txt)
            pcall(function()
                local privatePayload = "[WHISPER]: " + txt
                if TextChatService.ChatInputBarConfiguration.TargetTextChannel then
                    TextChatService.ChatInputBarConfiguration.TargetTextChannel:SendAsync(privatePayload)
                else
                    ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(privatePayload, "All")
                end
            end)
        end
    end
end

SendButton.MouseButton1Click:Connect(function()
    sendMessage(TextBox.Text)
    TextBox.Text = ""
end)

TextBox.FocusLost:Connect(function(enterPressed)
    if enterPressed then
        sendMessage(TextBox.Text)
        TextBox.Text = ""
    end
end)

local isOpen = true
ToggleButton.MouseButton1Click:Connect(function()
    isOpen = not isOpen
    MainFrame.Visible = isOpen
    if isOpen then
    	UIStrokeBtn.Color = Color3.fromRGB(0, 170, 255)
    else
    	UIStrokeBtn.Color = Color3.fromRGB(100, 100, 100)
    end
end)

local frameRgbMode = true
RunService.RenderStepped:Connect(function()
    local hue = tick() % 5 / 5
    local rgbColor = Color3.fromHSV(hue, 1, 1)
    
    if frameRgbMode then
        UIStroke.Color = rgbColor
        ColorButton.BackgroundColor3 = rgbColor
    end
    
    if nameRgbActive then
        NameBox.TextColor3 = rgbColor
        NameRGBButton.BackgroundColor3 = rgbColor
    end

    local blackRedHue = (math.sin(tick() * 3) + 1) / 2
    local systemColor = Color3.fromRGB(255 * blackRedHue, 0, 0)
    ProfileText.TextColor3 = systemColor

    for _, sysLabel in ipairs(systemMessages) do
        if sysLabel and sysLabel.Parent then
            sysLabel.TextColor3 = systemColor
        end
    end

    for _, item in ipairs(activeGlobalMessages) do
        if item.label and item.label.Parent then
            item.label.TextColor3 = rgbColor
            item.msgLabel.TextColor3 = rgbColor
        end
    end
end)

ColorButton.MouseButton1Click:Connect(function()
    frameRgbMode = not frameRgbMode
    if not frameRgbMode then
        UIStroke.Color = Color3.fromRGB(0, 255, 100)
        ColorButton.BackgroundColor3 = Color3.fromRGB(0, 255, 100)
    end
end)

Features & Information

Brokhaven chat
#Chat#brokhaven#Ro

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts