Xdemic global and server chat
Key RequiredUniversal

Xdemic global and server chat

Universal ScriptSkihubdevkaiserSkihubdevkaiser 740 views 212 executesUpdated Apr 8, 2026
Unrated
00
Lua Script•833 lines (31465 chars)
-- [[ XDEMIC COMPLETE CHAT SYSTEM ]] --
-- [[ GLOBAL CHAT | LOCAL BUBBLES | AUTO BIO | RANKS ]] --

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local CoreGui = game:GetService("CoreGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

if CoreGui:FindFirstChild("XdemicCompleteChat") then CoreGui.XdemicCompleteChat:Destroy() end

-- ========== RANKS & GOD PLAYERS ==========
local godPlayers = {"DAVID_BLOX65", "@DAVID_BLOX65", "KAISER"}
local vipPlayers = {"EMPIRECLAN", "XDEMIC", "KAISER"}

local function getPlayerRank(player)
    for _, god in ipairs(godPlayers) do
        if string.upper(player.Name) == string.upper(god) then
            return "👑 GOD"
        end
    end
    for _, vip in ipairs(vipPlayers) do
        if string.upper(player.Name) == string.upper(vip) then
            return "⭐ VIP"
        end
    end
    return "💬 MEMBER"
end

local isGod = false
for _, god in ipairs(godPlayers) do
    if string.upper(LocalPlayer.Name) == string.upper(god) then
        isGod = true
        break
    end
end

-- ========== CHANGE BROOKHAVEN BIO ==========
local function changeBio()
    local rank = getPlayerRank(LocalPlayer)
    local bioText = "Xdemic Chat User | " .. rank
    
    -- Brookhaven bio change remote
    local args = {
        [1] = bioText
    }
    local success, err = pcall(function()
        local remote = ReplicatedStorage:FindFirstChild("RE")
        if remote and remote:FindFirstChild("1Bio1Change") then
            remote["1Bio1Change"]:FireServer(unpack(args))
        elseif ReplicatedStorage:FindFirstChild("UpdateBio") then
            ReplicatedStorage.UpdateBio:FireServer(bioText)
        end
    end)
    
    print("Bio changed to: " .. bioText)
    return bioText
end

-- ========== VARIABLES ==========
local chatBubbles = {}
local customNames = {}
local rgbEnabled = true
local hue = 0
local currentTab = "GLOBAL"

-- ========== CREATE MAIN GUI ==========
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "XdemicCompleteChat"
ScreenGui.Parent = CoreGui
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

local MainFrame = Instance.new("Frame")
MainFrame.Size = UDim2.new(0, 650, 0, 720)
MainFrame.Position = UDim2.new(0.5, -325, 0.5, -360)
MainFrame.BackgroundColor3 = Color3.fromRGB(8, 10, 16)
MainFrame.Parent = ScreenGui
MainFrame.Active = true
MainFrame.Draggable = true
Instance.new("UICorner", MainFrame).CornerRadius = UDim.new(0, 16)

-- Top Bar
local TopBar = Instance.new("Frame")
TopBar.Size = UDim2.new(1, 0, 0, 60)
TopBar.BackgroundColor3 = Color3.fromRGB(18, 20, 28)
TopBar.Parent = MainFrame
Instance.new("UICorner", TopBar).CornerRadius = UDim.new(0, 16)

local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(0.5, 0, 1, 0)
Title.Position = UDim2.new(0.05, 0, 0, 0)
Title.Text = "💬 XDEMIC COMPLETE CHAT"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.BackgroundTransparency = 1
Title.Font = Enum.Font.GothamBold
Title.TextSize = 18
Title.Parent = TopBar

local BioLabel = Instance.new("TextLabel")
BioLabel.Size = UDim2.new(0.4, 0, 0.4, 0)
BioLabel.Position = UDim2.new(0.55, 0, 0.3, 0)
BioLabel.Text = "📝 Bio: " .. getPlayerRank(LocalPlayer)
BioLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
BioLabel.BackgroundTransparency = 1
BioLabel.Font = Enum.Font.Gotham
BioLabel.TextSize = 10
BioLabel.Parent = TopBar

-- Close Button
local CloseScriptBtn = Instance.new("TextButton")
CloseScriptBtn.Size = UDim2.new(0, 40, 0, 40)
CloseScriptBtn.Position = UDim2.new(1, -48, 0, 10)
CloseScriptBtn.Text = "✕"
CloseScriptBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
CloseScriptBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseScriptBtn.Font = Enum.Font.GothamBold
CloseScriptBtn.TextSize = 16
CloseScriptBtn.Parent = TopBar
Instance.new("UICorner", CloseScriptBtn).CornerRadius = UDim.new(0, 10)

-- ========== TAB BUTTONS ==========
local GlobalTab = Instance.new("TextButton")
GlobalTab.Size = UDim2.new(0.23, 0, 0, 42)
GlobalTab.Position = UDim2.new(0.02, 0, 0.1, 0)
GlobalTab.Text = "🌐 GLOBAL"
GlobalTab.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
GlobalTab.TextColor3 = Color3.fromRGB(255, 255, 255)
GlobalTab.Font = Enum.Font.GothamBold
GlobalTab.TextSize = 14
GlobalTab.Parent = MainFrame
Instance.new("UICorner", GlobalTab).CornerRadius = UDim.new(0, 8)

local LocalChatTab = Instance.new("TextButton")
LocalChatTab.Size = UDim2.new(0.23, 0, 0, 42)
LocalChatTab.Position = UDim2.new(0.26, 0, 0.1, 0)
LocalChatTab.Text = "💬 LOCAL"
LocalChatTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
LocalChatTab.TextColor3 = Color3.fromRGB(255, 255, 255)
LocalChatTab.Font = Enum.Font.GothamBold
LocalChatTab.TextSize = 14
LocalChatTab.Parent = MainFrame
Instance.new("UICorner", LocalChatTab).CornerRadius = UDim.new(0, 8)

local PrivateTab = Instance.new("TextButton")
PrivateTab.Size = UDim2.new(0.23, 0, 0, 42)
PrivateTab.Position = UDim2.new(0.5, 0, 0.1, 0)
PrivateTab.Text = "🔒 PRIVATE"
PrivateTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
PrivateTab.TextColor3 = Color3.fromRGB(255, 255, 255)
PrivateTab.Font = Enum.Font.GothamBold
PrivateTab.TextSize = 14
PrivateTab.Parent = MainFrame
Instance.new("UICorner", PrivateTab).CornerRadius = UDim.new(0, 8)

local SettingsTab = Instance.new("TextButton")
SettingsTab.Size = UDim2.new(0.23, 0, 0, 42)
SettingsTab.Position = UDim2.new(0.74, 0, 0.1, 0)
SettingsTab.Text = "⚙️ SETTINGS"
SettingsTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
SettingsTab.TextColor3 = Color3.fromRGB(255, 255, 255)
SettingsTab.Font = Enum.Font.GothamBold
SettingsTab.TextSize = 14
SettingsTab.Parent = MainFrame
Instance.new("UICorner", SettingsTab).CornerRadius = UDim.new(0, 8)

-- ========== GLOBAL CHAT TAB ==========
local GlobalContainer = Instance.new("Frame")
GlobalContainer.Size = UDim2.new(0.96, 0, 0.6, 0)
GlobalContainer.Position = UDim2.new(0.02, 0, 0.18, 0)
GlobalContainer.BackgroundColor3 = Color3.fromRGB(15, 17, 24)
GlobalContainer.Parent = MainFrame
Instance.new("UICorner", GlobalContainer).CornerRadius = UDim.new(0, 12)

local GlobalScroll = Instance.new("ScrollingFrame")
GlobalScroll.Size = UDim2.new(1, 0, 1, 0)
GlobalScroll.BackgroundTransparency = 1
GlobalScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
GlobalScroll.ScrollBarThickness = 4
GlobalScroll.Parent = GlobalContainer

local GlobalLayout = Instance.new("UIListLayout")
GlobalLayout.Padding = UDim.new(0, 8)
GlobalLayout.Parent = GlobalScroll

local GlobalInput = Instance.new("TextBox")
GlobalInput.Size = UDim2.new(0.96, 0, 0, 50)
GlobalInput.Position = UDim2.new(0.02, 0, 0.8, 0)
GlobalInput.BackgroundColor3 = Color3.fromRGB(28, 30, 38)
GlobalInput.TextColor3 = Color3.fromRGB(255, 255, 255)
GlobalInput.PlaceholderText = "🌐 Type global message... (all servers)"
GlobalInput.PlaceholderColor3 = Color3.fromRGB(100, 105, 130)
GlobalInput.Text = ""
GlobalInput.Font = Enum.Font.Gotham
GlobalInput.TextSize = 14
GlobalInput.Parent = MainFrame
Instance.new("UICorner", GlobalInput).CornerRadius = UDim.new(0, 10)

local GlobalSend = Instance.new("TextButton")
GlobalSend.Size = UDim2.new(0.96, 0, 0, 45)
GlobalSend.Position = UDim2.new(0.02, 0, 0.88, 0)
GlobalSend.Text = "🌍 SEND GLOBAL"
GlobalSend.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
GlobalSend.TextColor3 = Color3.fromRGB(255, 255, 255)
GlobalSend.Font = Enum.Font.GothamBold
GlobalSend.TextSize = 14
GlobalSend.Parent = MainFrame
Instance.new("UICorner", GlobalSend).CornerRadius = UDim.new(0, 10)

-- ========== LOCAL CHAT TAB ==========
local LocalContainer = Instance.new("Frame")
LocalContainer.Size = UDim2.new(0.96, 0, 0.6, 0)
LocalContainer.Position = UDim2.new(0.02, 0, 0.18, 0)
LocalContainer.BackgroundColor3 = Color3.fromRGB(15, 17, 24)
LocalContainer.Parent = MainFrame
LocalContainer.Visible = false
Instance.new("UICorner", LocalContainer).CornerRadius = UDim.new(0, 12)

local LocalScroll = Instance.new("ScrollingFrame")
LocalScroll.Size = UDim2.new(1, 0, 1, 0)
LocalScroll.BackgroundTransparency = 1
LocalScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
LocalScroll.ScrollBarThickness = 4
LocalScroll.Parent = LocalContainer

local LocalLayout = Instance.new("UIListLayout")
LocalLayout.Padding = UDim.new(0, 8)
LocalLayout.Parent = LocalScroll

local LocalInput = Instance.new("TextBox")
LocalInput.Size = UDim2.new(0.96, 0, 0, 50)
LocalInput.Position = UDim2.new(0.02, 0, 0.8, 0)
LocalInput.BackgroundColor3 = Color3.fromRGB(28, 30, 38)
LocalInput.TextColor3 = Color3.fromRGB(255, 255, 255)
LocalInput.PlaceholderText = "💬 Type local message... (same server, shows bubble)"
LocalInput.PlaceholderColor3 = Color3.fromRGB(100, 105, 130)
LocalInput.Text = ""
LocalInput.Font = Enum.Font.Gotham
LocalInput.TextSize = 14
LocalInput.Parent = MainFrame
LocalInput.Visible = false
Instance.new("UICorner", LocalInput).CornerRadius = UDim.new(0, 10)

local LocalSend = Instance.new("TextButton")
LocalSend.Size = UDim2.new(0.96, 0, 0, 45)
LocalSend.Position = UDim2.new(0.02, 0, 0.88, 0)
LocalSend.Text = "💬 SEND LOCAL (WITH BUBBLE)"
LocalSend.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
LocalSend.TextColor3 = Color3.fromRGB(255, 255, 255)
LocalSend.Font = Enum.Font.GothamBold
LocalSend.TextSize = 13
LocalSend.Parent = MainFrame
LocalSend.Visible = false
Instance.new("UICorner", LocalSend).CornerRadius = UDim.new(0, 10)

-- ========== PRIVATE CHAT TAB ==========
local PrivateContainer = Instance.new("Frame")
PrivateContainer.Size = UDim2.new(0.96, 0, 0.6, 0)
PrivateContainer.Position = UDim2.new(0.02, 0, 0.18, 0)
PrivateContainer.BackgroundColor3 = Color3.fromRGB(15, 17, 24)
PrivateContainer.Parent = MainFrame
PrivateContainer.Visible = false
Instance.new("UICorner", PrivateContainer).CornerRadius = UDim.new(0, 12)

local PrivateScroll = Instance.new("ScrollingFrame")
PrivateScroll.Size = UDim2.new(1, 0, 1, 0)
PrivateScroll.BackgroundTransparency = 1
PrivateScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
PrivateScroll.ScrollBarThickness = 4
PrivateScroll.Parent = PrivateContainer

local PrivateLayout = Instance.new("UIListLayout")
PrivateLayout.Padding = UDim.new(0, 8)
PrivateLayout.Parent = PrivateScroll

-- Player List
local PlayerListFrame = Instance.new("Frame")
PlayerListFrame.Size = UDim2.new(0.3, 0, 0.6, 0)
PlayerListFrame.Position = UDim2.new(0.02, 0, 0.18, 0)
PlayerListFrame.BackgroundColor3 = Color3.fromRGB(22, 24, 32)
PlayerListFrame.Parent = MainFrame
PlayerListFrame.Visible = false
Instance.new("UICorner", PlayerListFrame).CornerRadius = UDim.new(0, 12)

local PlayerListScroll = Instance.new("ScrollingFrame")
PlayerListScroll.Size = UDim2.new(1, 0, 1, 0)
PlayerListScroll.BackgroundTransparency = 1
PlayerListScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
PlayerListScroll.ScrollBarThickness = 4
PlayerListScroll.Parent = PlayerListFrame

local PlayerListLayout = Instance.new("UIListLayout")
PlayerListLayout.Padding = UDim.new(0, 5)
PlayerListLayout.Parent = PlayerListScroll

local PrivateInput = Instance.new("TextBox")
PrivateInput.Size = UDim2.new(0.6, 0, 0, 50)
PrivateInput.Position = UDim2.new(0.34, 0, 0.8, 0)
PrivateInput.BackgroundColor3 = Color3.fromRGB(28, 30, 38)
PrivateInput.TextColor3 = Color3.fromRGB(255, 255, 255)
PrivateInput.PlaceholderText = "🔒 Private message..."
PrivateInput.PlaceholderColor3 = Color3.fromRGB(100, 105, 130)
PrivateInput.Text = ""
PrivateInput.Font = Enum.Font.Gotham
PrivateInput.TextSize = 14
PrivateInput.Parent = MainFrame
PrivateInput.Visible = false
Instance.new("UICorner", PrivateInput).CornerRadius = UDim.new(0, 10)

local PrivateSend = Instance.new("TextButton")
PrivateSend.Size = UDim2.new(0.2, 0, 0, 45)
PrivateSend.Position = UDim2.new(0.74, 0, 0.88, 0)
PrivateSend.Text = "🔒 SEND"
PrivateSend.BackgroundColor3 = Color3.fromRGB(100, 90, 220)
PrivateSend.TextColor3 = Color3.fromRGB(255, 255, 255)
PrivateSend.Font = Enum.Font.GothamBold
PrivateSend.TextSize = 13
PrivateSend.Parent = MainFrame
PrivateSend.Visible = false
Instance.new("UICorner", PrivateSend).CornerRadius = UDim.new(0, 10)

local ExitPrivateBtn = Instance.new("TextButton")
ExitPrivateBtn.Size = UDim2.new(0, 100, 0, 35)
ExitPrivateBtn.Position = UDim2.new(0.8, 0, 0.1, 0)
ExitPrivateBtn.Text = "🚪 EXIT"
ExitPrivateBtn.BackgroundColor3 = Color3.fromRGB(200, 80, 80)
ExitPrivateBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
ExitPrivateBtn.Font = Enum.Font.GothamBold
ExitPrivateBtn.TextSize = 12
ExitPrivateBtn.Parent = MainFrame
ExitPrivateBtn.Visible = false
Instance.new("UICorner", ExitPrivateBtn).CornerRadius = UDim.new(0, 8)

-- ========== SETTINGS TAB ==========
local SettingsContainer = Instance.new("Frame")
SettingsContainer.Size = UDim2.new(0.96, 0, 0.68, 0)
SettingsContainer.Position = UDim2.new(0.02, 0, 0.18, 0)
SettingsContainer.BackgroundColor3 = Color3.fromRGB(15, 17, 24)
SettingsContainer.Parent = MainFrame
SettingsContainer.Visible = false
Instance.new("UICorner", SettingsContainer).CornerRadius = UDim.new(0, 12)

local NameLabel = Instance.new("TextLabel")
NameLabel.Size = UDim2.new(0.9, 0, 0, 30)
NameLabel.Position = UDim2.new(0.05, 0, 0.05, 0)
NameLabel.Text = isGod and "👑 GOD NAME CHANGE" or "🔒 NAME CHANGE (GOD ONLY)"
NameLabel.TextColor3 = isGod and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(200, 100, 100)
NameLabel.BackgroundTransparency = 1
NameLabel.Font = Enum.Font.GothamBold
NameLabel.TextSize = 13
NameLabel.Parent = SettingsContainer

local NameInput = Instance.new("TextBox")
NameInput.Size = UDim2.new(0.6, 0, 0, 40)
NameInput.Position = UDim2.new(0.05, 0, 0.12, 0)
NameInput.BackgroundColor3 = Color3.fromRGB(28, 30, 38)
NameInput.TextColor3 = Color3.fromRGB(255, 255, 255)
NameInput.PlaceholderText = isGod and "Enter custom name..." or "Only GOD players"
NameInput.Text = LocalPlayer.Name
NameInput.Font = Enum.Font.Gotham
NameInput.TextSize = 14
NameInput.Parent = SettingsContainer
NameInput.Visible = isGod
Instance.new("UICorner", NameInput).CornerRadius = UDim.new(0, 8)

local NameApply = Instance.new("TextButton")
NameApply.Size = UDim2.new(0.25, 0, 0, 38)
NameApply.Position = UDim2.new(0.68, 0, 0.12, 0)
NameApply.Text = "APPLY"
NameApply.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
NameApply.TextColor3 = Color3.fromRGB(255, 255, 255)
NameApply.Font = Enum.Font.GothamBold
NameApply.TextSize = 13
NameApply.Parent = SettingsContainer
NameApply.Visible = isGod
Instance.new("UICorner", NameApply).CornerRadius = UDim.new(0, 8)

-- RGB Toggle
local RGBLabel = Instance.new("TextLabel")
RGBLabel.Size = UDim2.new(0.9, 0, 0, 30)
RGBLabel.Position = UDim2.new(0.05, 0, 0.25, 0)
RGBLabel.Text = isGod and "🎨 RGB NAME COLOR" or "🔒 RGB NAMES (GOD ONLY)"
RGBLabel.TextColor3 = isGod and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(200, 100, 100)
RGBLabel.BackgroundTransparency = 1
RGBLabel.Font = Enum.Font.GothamBold
RGBLabel.TextSize = 13
RGBLabel.Parent = SettingsContainer

local RGBToggle = Instance.new("TextButton")
RGBToggle.Size = UDim2.new(0.6, 0, 0, 40)
RGBToggle.Position = UDim2.new(0.05, 0, 0.32, 0)
RGBToggle.Text = "🎨 RGB NAMES: ON"
RGBToggle.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
RGBToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
RGBToggle.Font = Enum.Font.GothamBold
RGBToggle.TextSize = 14
RGBToggle.Parent = SettingsContainer
RGBToggle.Visible = isGod
Instance.new("UICorner", RGBToggle).CornerRadius = UDim.new(0, 8)

-- ========== CHAT BUBBLE FUNCTION (LIKE ROBLOX, STAYS 10 SEC) ==========
local function createChatBubble(player, message)
    if not player or not player.Character then return end
    
    local head = player.Character:FindFirstChild("Head")
    if not head then return end
    
    -- Remove existing bubble
    if chatBubbles[player] then
        chatBubbles[player]:Destroy()
    end
    
    -- Create new bubble
    local billboard = Instance.new("BillboardGui")
    billboard.Name = "XdemicChatBubble"
    billboard.Adornee = head
    billboard.Size = UDim2.new(0, 200, 0, 60)
    billboard.StudsOffset = Vector3.new(0, 2.5, 0)
    billboard.AlwaysOnTop = true
    billboard.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
    billboard.Parent = head
    
    local bubbleFrame = Instance.new("Frame")
    bubbleFrame.Size = UDim2.new(1, 0, 1, 0)
    bubbleFrame.BackgroundColor3 = Color3.fromRGB(25, 28, 38)
    bubbleFrame.BackgroundTransparency = 0.1
    bubbleFrame.Parent = billboard
    Instance.new("UICorner", bubbleFrame).CornerRadius = UDim.new(0, 12)
    
    local stroke = Instance.new("UIStroke", bubbleFrame)
    stroke.Color = Color3.fromRGB(80, 85, 200)
    stroke.Thickness = 2
    
    local rank = getPlayerRank(player)
    local rankColor = rank == "👑 GOD" and Color3.fromRGB(255, 215, 0) or (rank == "⭐ VIP" and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(80, 150, 255))
    
    local rankLabel = Instance.new("TextLabel")
    rankLabel.Size = UDim2.new(1, 0, 0, 18)
    rankLabel.Position = UDim2.new(0, 0, 0, 2)
    rankLabel.Text = rank .. " | " .. player.Name
    rankLabel.TextColor3 = rankColor
    rankLabel.BackgroundTransparency = 1
    rankLabel.Font = Enum.Font.GothamBold
    rankLabel.TextSize = 11
    rankLabel.TextXAlignment = Enum.TextXAlignment.Center
    rankLabel.Parent = bubbleFrame
    
    local msgLabel = Instance.new("TextLabel")
    msgLabel.Size = UDim2.new(1, 0, 0, 35)
    msgLabel.Position = UDim2.new(0, 0, 0, 20)
    msgLabel.Text = message
    msgLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    msgLabel.BackgroundTransparency = 1
    msgLabel.TextWrapped = true
    msgLabel.Font = Enum.Font.Gotham
    msgLabel.TextSize = 13
    msgLabel.TextXAlignment = Enum.TextXAlignment.Center
    msgLabel.Parent = bubbleFrame
    
    chatBubbles[player] = billboard
    
    -- Auto remove after 10 seconds
    task.wait(10)
    if chatBubbles[player] then
        chatBubbles[player]:Destroy()
        chatBubbles[player] = nil
    end
end

-- ========== FUNCTIONS ==========
local function getDisplayName(player)
    if customNames[player.UserId] then
        return customNames[player.UserId]
    end
    return player.Name
end

local function getRGBColor(player)
    if rgbEnabled and isGod then
        local r = math.sin(hue) * 0.5 + 0.5
        local g = math.sin(hue + 2.094) * 0.5 + 0.5
        local b = math.sin(hue + 4.188) * 0.5 + 0.5
        return Color3.new(r, g, b)
    end
    return Color3.fromRGB(180, 190, 255)
end

local function antiTag(msg)
    local result = ""
    for i = 1, #msg do
        result = result .. msg:sub(i, i)
        if i % 3 == 0 then
            result = result .. "\226\128\139"
        end
    end
    return result
end

-- ========== ADD MESSAGES TO UI ==========
local function addGlobalMessage(player, message, isSystem)
    local msgFrame = Instance.new("Frame")
    msgFrame.Size = UDim2.new(1, 0, 0, 0)
    msgFrame.AutomaticSize = Enum.AutomaticSize.Y
    msgFrame.BackgroundTransparency = 1
    msgFrame.Parent = GlobalScroll
    
    local rank = isSystem and "🔔" or getPlayerRank(player)
    local rankColor = isSystem and Color3.fromRGB(255, 200, 100) or (rank == "👑 GOD" and Color3.fromRGB(255, 215, 0) or (rank == "⭐ VIP" and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(80, 150, 255)))
    
    local nameLabel = Instance.new("TextLabel")
    nameLabel.Size = UDim2.new(1, 0, 0, 20)
    nameLabel.Text = isSystem and "🔔 SYSTEM:" or rank .. " " .. getDisplayName(player) .. ":"
    nameLabel.TextColor3 = rankColor
    nameLabel.BackgroundTransparency = 1
    nameLabel.Font = Enum.Font.GothamBold
    nameLabel.TextSize = 12
    nameLabel.TextXAlignment = Enum.TextXAlignment.Left
    nameLabel.Parent = msgFrame
    
    local msgLabel = Instance.new("TextLabel")
    msgLabel.Size = UDim2.new(1, 0, 0, 0)
    msgLabel.AutomaticSize = Enum.AutomaticSize.Y
    msgLabel.Position = UDim2.new(0, 0, 0, 22)
    msgLabel.Text = message
    msgLabel.TextColor3 = Color3.fromRGB(220, 220, 240)
    msgLabel.BackgroundTransparency = 1
    msgLabel.TextWrapped = true
    msgLabel.Font = Enum.Font.Gotham
    msgLabel.TextSize = 13
    msgLabel.Parent = msgFrame
    
    task.wait(0.05)
    GlobalScroll.CanvasPosition = Vector2.new(0, GlobalLayout.AbsoluteContentSize.Y)
    GlobalScroll.CanvasSize = UDim2.new(0, 0, 0, GlobalLayout.AbsoluteContentSize.Y + 50)
end

local function addLocalMessage(player, message)
    local msgFrame = Instance.new("Frame")
    msgFrame.Size = UDim2.new(1, 0, 0, 0)
    msgFrame.AutomaticSize = Enum.AutomaticSize.Y
    msgFrame.BackgroundTransparency = 1
    msgFrame.Parent = LocalScroll
    
    local rank = getPlayerRank(player)
    local rankColor = rank == "👑 GOD" and Color3.fromRGB(255, 215, 0) or (rank == "⭐ VIP" and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(80, 150, 255))
    
    local nameLabel = Instance.new("TextLabel")
    nameLabel.Size = UDim2.new(1, 0, 0, 20)
    nameLabel.Text = rank .. " " .. getDisplayName(player) .. " [LOCAL]:"
    nameLabel.TextColor3 = rankColor
    nameLabel.BackgroundTransparency = 1
    nameLabel.Font = Enum.Font.GothamBold
    nameLabel.TextSize = 12
    nameLabel.TextXAlignment = Enum.TextXAlignment.Left
    nameLabel.Parent = msgFrame
    
    local msgLabel = Instance.new("TextLabel")
    msgLabel.Size = UDim2.new(1, 0, 0, 0)
    msgLabel.AutomaticSize = Enum.AutomaticSize.Y
    msgLabel.Position = UDim2.new(0, 0, 0, 22)
    msgLabel.Text = message
    msgLabel.TextColor3 = Color3.fromRGB(220, 220, 240)
    msgLabel.BackgroundTransparency = 1
    msgLabel.TextWrapped = true
    msgLabel.Font = Enum.Font.Gotham
    msgLabel.TextSize = 13
    msgLabel.Parent = msgFrame
    
    task.wait(0.05)
    LocalScroll.CanvasPosition = Vector2.new(0, LocalLayout.AbsoluteContentSize.Y)
    LocalScroll.CanvasSize = UDim2.new(0, 0, 0, LocalLayout.AbsoluteContentSize.Y + 50)
    
    -- Create bubble for local messages
    createChatBubble(player, message)
end

local function addPrivateMessage(sender, message, isOwn)
    local msgFrame = Instance.new("Frame")
    msgFrame.Size = UDim2.new(1, 0, 0, 0)
    msgFrame.AutomaticSize = Enum.AutomaticSize.Y
    msgFrame.BackgroundTransparency = 1
    msgFrame.Parent = PrivateScroll
    
    local bubble = Instance.new("Frame")
    bubble.Size = UDim2.new(0.7, 0, 0, 0)
    bubble.AutomaticSize = Enum.AutomaticSize.Y
    bubble.Position = isOwn and UDim2.new(0.3, -10, 0, 0) or UDim2.new(0, 10, 0, 0)
    bubble.BackgroundColor3 = isOwn and Color3.fromRGB(80, 85, 200) or Color3.fromRGB(40, 42, 55)
    bubble.Parent = msgFrame
    Instance.new("UICorner", bubble).CornerRadius = UDim.new(0, 12)
    
    local rank = getPlayerRank(sender)
    local rankColor = rank == "👑 GOD" and Color3.fromRGB(255, 215, 0) or (rank == "⭐ VIP" and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(80, 150, 255))
    
    local nameLabel = Instance.new("TextLabel")
    nameLabel.Size = UDim2.new(0.98, 0, 0, 18)
    nameLabel.Position = UDim2.new(0.01, 0, 0.02, 0)
    nameLabel.Text = rank .. " " .. getDisplayName(sender) .. " [PRIVATE]:"
    nameLabel.TextColor3 = rankColor
    nameLabel.BackgroundTransparency = 1
    nameLabel.Font = Enum.Font.GothamBold
    nameLabel.TextSize = 11
    nameLabel.TextXAlignment = Enum.TextXAlignment.Left
    nameLabel.Parent = bubble
    
    local msgLabel = Instance.new("TextLabel")
    msgLabel.Size = UDim2.new(0.98, 0, 0, 0)
    msgLabel.AutomaticSize = Enum.AutomaticSize.Y
    msgLabel.Position = UDim2.new(0.01, 0, 0.22, 0)
    msgLabel.Text = message
    msgLabel.TextColor3 = Color3.fromRGB(220, 220, 240)
    msgLabel.BackgroundTransparency = 1
    msgLabel.TextWrapped = true
    msgLabel.Font = Enum.Font.Gotham
    msgLabel.TextSize = 13
    msgLabel.Parent = bubble
    
    task.wait(0.05)
    PrivateScroll.CanvasPosition = Vector2.new(0, PrivateLayout.AbsoluteContentSize.Y)
    PrivateScroll.CanvasSize = UDim2.new(0, 0, 0, PrivateLayout.AbsoluteContentSize.Y + 50)
end

-- ========== UPDATE PLAYER LIST ==========
local function updatePlayerList()
    for _, v in pairs(PlayerListScroll:GetChildren()) do
        if v:IsA("TextButton") then v:Destroy() end
    end
    
    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer then
            local btn = Instance.new("TextButton")
            btn.Size = UDim2.new(0.96, 0, 0, 45)
            btn.Position = UDim2.new(0.02, 0, 0, 0)
            local rank = getPlayerRank(player)
            btn.Text = rank .. " " .. getDisplayName(player)
            btn.BackgroundColor3 = Color3.fromRGB(35, 37, 48)
            btn.TextColor3 = rank == "👑 GOD" and Color3.fromRGB(255, 215, 0) or Color3.fromRGB(255, 255, 255)
            btn.Font = Enum.Font.GothamBold
            btn.TextSize = 12
            btn.Parent = PlayerListScroll
            Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 8)
            
            btn.MouseButton1Click:Connect(function()
                privateChatPartner = player
                addPrivateMessage(LocalPlayer, "Started private chat with " .. getDisplayName(player), true)
                PrivateInput.Visible = true
                PrivateSend.Visible = true
                ExitPrivateBtn.Visible = true
                PlayerListFrame.Visible = false
                PrivateContainer.Visible = true
            end)
        end
    end
end

-- ========== SEND MESSAGES ==========
GlobalSend.MouseButton1Click:Connect(function()
    if GlobalInput.Text ~= "" then
        local msg = antiTag(GlobalInput.Text)
        addGlobalMessage(LocalPlayer, msg, false)
        GlobalInput.Text = ""
    end
end)

LocalSend.MouseButton1Click:Connect(function()
    if LocalInput.Text ~= "" then
        local msg = antiTag(LocalInput.Text)
        addLocalMessage(LocalPlayer, msg)
        LocalInput.Text = ""
    end
end)

PrivateSend.MouseButton1Click:Connect(function()
    if PrivateInput.Text ~= "" and privateChatPartner then
        local msg = antiTag(PrivateInput.Text)
        addPrivateMessage(LocalPlayer, msg, true)
        PrivateInput.Text = ""
    end
end)

-- ========== EXIT PRIVATE ==========
ExitPrivateBtn.MouseButton1Click:Connect(function()
    privateChatPartner = nil
    PrivateInput.Visible = false
    PrivateSend.Visible = false
    ExitPrivateBtn.Visible = false
    PlayerListFrame.Visible = true
    PrivateContainer.Visible = false
    for _, v in pairs(PrivateScroll:GetChildren()) do
        if v:IsA("Frame") then v:Destroy() end
    end
end)

-- ========== TAB SWITCHING ==========
GlobalTab.MouseButton1Click:Connect(function()
    currentTab = "GLOBAL"
    GlobalTab.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
    LocalChatTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    PrivateTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    SettingsTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    GlobalContainer.Visible = true
    LocalContainer.Visible = false
    PrivateContainer.Visible = false
    SettingsContainer.Visible = false
    PlayerListFrame.Visible = false
    GlobalInput.Visible = true
    GlobalSend.Visible = true
    LocalInput.Visible = false
    LocalSend.Visible = false
    PrivateInput.Visible = false
    PrivateSend.Visible = false
    ExitPrivateBtn.Visible = false
end)

LocalChatTab.MouseButton1Click:Connect(function()
    currentTab = "LOCAL"
    GlobalTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    LocalChatTab.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
    PrivateTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    SettingsTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    GlobalContainer.Visible = false
    LocalContainer.Visible = true
    PrivateContainer.Visible = false
    SettingsContainer.Visible = false
    PlayerListFrame.Visible = false
    GlobalInput.Visible = false
    GlobalSend.Visible = false
    LocalInput.Visible = true
    LocalSend.Visible = true
    PrivateInput.Visible = false
    PrivateSend.Visible = false
    ExitPrivateBtn.Visible = false
end)

PrivateTab.MouseButton1Click:Connect(function()
    currentTab = "PRIVATE"
    GlobalTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    LocalChatTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    PrivateTab.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
    SettingsTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    GlobalContainer.Visible = false
    LocalContainer.Visible = false
    PrivateContainer.Visible = false
    SettingsContainer.Visible = false
    PlayerListFrame.Visible = true
    GlobalInput.Visible = false
    GlobalSend.Visible = false
    LocalInput.Visible = false
    LocalSend.Visible = false
    PrivateInput.Visible = false
    PrivateSend.Visible = false
    ExitPrivateBtn.Visible = false
    updatePlayerList()
end)

SettingsTab.MouseButton1Click:Connect(function()
    currentTab = "SETTINGS"
    GlobalTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    LocalChatTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    PrivateTab.BackgroundColor3 = Color3.fromRGB(40, 42, 50)
    SettingsTab.BackgroundColor3 = Color3.fromRGB(80, 85, 200)
    GlobalContainer.Visible = false
    LocalContainer.Visible = false
    PrivateContainer.Visible = false
    SettingsContainer.Visible = true
    PlayerListFrame.Visible = false
    GlobalInput.Visible = false
    GlobalSend.Visible = false
    LocalInput.Visible = false
    LocalSend.Visible = false
    PrivateInput.Visible = false
    PrivateSend.Visible = false
    ExitPrivateBtn.Visible = false
end)

-- ========== SETTINGS ==========
if isGod then
    NameApply.MouseButton1Click:Connect(function()
        if NameInput.Text ~= "" then
            customNames[LocalPlayer.UserId] = NameInput.Text
            addGlobalMessage(LocalPlayer, "✨ Changed name to " .. NameInput.Text .. " ✨", false)
        end
    end)
    
    local rgbState = true
    RGBToggle.MouseButton1Click:Connect(function()
        rgbState = not rgbState
        rgbEnabled = rgbState
        RGBToggle.Text = rgbState and "🎨 RGB NAMES: ON" or "🎨 RGB NAMES: OFF"
        RGBToggle.BackgroundColor3 = rgbState and Color3.fromRGB(80, 85, 200) or Color3.fromRGB(60, 60, 90)
    end)
end

-- ========== CLOSE SCRIPT ==========
CloseScriptBtn.MouseButton1Click:Connect(function()
    ScreenGui:Destroy()
end)

-- ========== CHANGE BIO ON START ==========
local bioText = changeBio()
BioLabel.Text = "📝 Bio: " .. getPlayerRank(LocalPlayer)

-- ========== RGB COLOR LOOP ==========
task.spawn(function()
    while ScreenGui.Parent do
        if rgbEnabled and isGod then
            hue = hue + 0.03
            if hue > math.pi * 2 then hue = 0 end
        end
        task.wait(0.05)
    end
end)

-- ========== WELCOME MESSAGES ==========
addGlobalMessage(LocalPlayer, "✨ XDEMIC COMPLETE CHAT SYSTEM ACTIVATED! ✨", true)
addGlobalMessage(LocalPlayer, "🌐 GLOBAL TAB - Cross-server messaging", true)
addGlobalMessage(LocalPlayer, "💬 LOCAL TAB - Messages with 10 sec bubbles", true)
addGlobalMessage(LocalPlayer, "🔒 PRIVATE TAB - Click player to start private chat", true)
addGlobalMessage(LocalPlayer, "📝 Your Brookhaven bio changed to: " .. bioText, true)

if isGod then
    addGlobalMessage(LocalPlayer, "👑 GOD " .. LocalPlayer.Name .. " has joined! RGB colors active! 👑", false)
end

print("=========================================")
print("XDEMIC COMPLETE CHAT LOADED!")
print("Features:")
print("  - Global Chat Tab")
print("  - Local Chat with 10 sec bubbles")
print("  - Private Chat with players")
print("  - Auto Bio Change in Brookhaven")
print("  - Rank System (GOD, VIP, MEMBER)")
print("  - RGB Names for GOD players")
print("=========================================")

Features & Information

Global chat, server chat, private chat Sabka baap

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts