--// ANSHUU CHAT - CLIENT WITH EMOJI SYSTEM --// Put this LocalScript inside: StarterPlayer > StarterPlayerScripts local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local TweenService = game:GetService("TweenService") local TextService = game:GetService("TextService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -------------------------------------------------- -- WAIT FOR SERVER REMOTE -------------------------------------------------- local remote = ReplicatedStorage:WaitForChild("AnshuuChatEvent", 10) if not remote then warn("ANSHUU CHAT: RemoteEvent 'AnshuuChatEvent' not found in ReplicatedStorage!") end -------------------------------------------------- -- REMOVE OLD GUI IF EXISTS -------------------------------------------------- local old = playerGui:FindFirstChild("AnshuuChatGui") if old then old:Destroy() end -------------------------------------------------- -- SCREEN GUI SETUP -------------------------------------------------- local gui = Instance.new("ScreenGui") gui.Name = "AnshuuChatGui" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.Parent = playerGui -------------------------------------------------- -- CHAT TAB BUTTON (OPEN TOGGLE) -------------------------------------------------- local chatButton = Instance.new("TextButton") chatButton.Name = "ChatButton" chatButton.AnchorPoint = Vector2.new(0, 0.5) chatButton.Position = UDim2.new(0, 15, 0.55, 0) chatButton.Size = UDim2.new(0, 45, 0, 110) chatButton.BackgroundColor3 = Color3.fromRGB(20, 20, 20) chatButton.BackgroundTransparency = 0.15 chatButton.Text = "C\nH\nA\nT" chatButton.TextColor3 = Color3.fromRGB(255, 255, 255) chatButton.TextSize = 14 chatButton.Font = Enum.Font.GothamBold chatButton.AutoButtonColor = false chatButton.ZIndex = 50 chatButton.Parent = gui local chatCorner = Instance.new("UICorner") chatCorner.CornerRadius = UDim.new(0, 10) chatCorner.Parent = chatButton local chatStroke = Instance.new("UIStroke") chatStroke.Thickness = 2 chatStroke.Parent = chatButton -------------------------------------------------- -- MAIN WINDOW -------------------------------------------------- local main = Instance.new("Frame") main.Name = "AnshuuChat" main.AnchorPoint = Vector2.new(0.5, 0.5) local CLOSED_POS = UDim2.new(0.5, 0, 1.5, 0) local OPEN_POS = UDim2.new(0.5, 0, 0.5, 0) main.Position = CLOSED_POS main.Size = UDim2.new(0, 320, 0, 360) main.BackgroundColor3 = Color3.fromRGB(12, 12, 14) main.BackgroundTransparency = 0.05 main.BorderSizePixel = 0 main.Visible = false main.ZIndex = 20 main.Parent = gui local mainCorner = Instance.new("UICorner") mainCorner.CornerRadius = UDim.new(0, 12) mainCorner.Parent = main local mainStroke = Instance.new("UIStroke") mainStroke.Thickness = 2 mainStroke.Parent = main -------------------------------------------------- -- RGB BORDER ANIMATION -------------------------------------------------- task.spawn(function() local hue = 0 while gui.Parent do hue = (hue + 0.004) % 1 local rgb = Color3.fromHSV(hue, 1, 1) mainStroke.Color = rgb chatStroke.Color = rgb task.wait(0.03) end end) -------------------------------------------------- -- HEADER -------------------------------------------------- local header = Instance.new("Frame") header.Size = UDim2.new(1, 0, 0, 42) header.BackgroundColor3 = Color3.fromRGB(18, 18, 22) header.BorderSizePixel = 0 header.ZIndex = 21 header.Parent = main local headerCorner = Instance.new("UICorner") headerCorner.CornerRadius = UDim.new(0, 12) headerCorner.Parent = header local title = Instance.new("TextLabel") title.Position = UDim2.new(0, 12, 0, 5) title.Size = UDim2.new(1, -50, 0, 18) title.BackgroundTransparency = 1 title.Text = "ANSHUU CHAT" title.Font = Enum.Font.GothamBold title.TextSize = 15 title.TextColor3 = Color3.new(1, 1, 1) title.TextXAlignment = Enum.TextXAlignment.Left title.ZIndex = 22 title.Parent = header local subtitle = Instance.new("TextLabel") subtitle.Position = UDim2.new(0, 13, 0, 23) subtitle.Size = UDim2.new(1, -50, 0, 14) subtitle.BackgroundTransparency = 1 subtitle.Text = "💬 PRIVATE • DIVINE CHAT" subtitle.Font = Enum.Font.Gotham subtitle.TextSize = 9 subtitle.TextColor3 = Color3.fromRGB(160, 160, 160) subtitle.TextXAlignment = Enum.TextXAlignment.Left subtitle.ZIndex = 22 subtitle.Parent = header -------------------------------------------------- -- CLOSE BUTTON & TOGGLE SYSTEM -------------------------------------------------- local close = Instance.new("TextButton") close.Size = UDim2.new(0, 26, 0, 26) close.Position = UDim2.new(1, -32, 0, 8) close.BackgroundColor3 = Color3.fromRGB(35, 35, 40) close.Text = "✕" close.Font = Enum.Font.GothamBold close.TextSize = 12 close.TextColor3 = Color3.new(1, 1, 1) close.ZIndex = 25 close.Parent = header local closeCorner = Instance.new("UICorner") closeCorner.CornerRadius = UDim.new(1, 0) closeCorner.Parent = close local isOpen = false local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quart, Enum.EasingDirection.Out) local function toggleChat() isOpen = not isOpen if isOpen then main.Visible = true TweenService:Create(main, tweenInfo, {Position = OPEN_POS}):Play() else local tween = TweenService:Create(main, tweenInfo, {Position = CLOSED_POS}) tween:Play() tween.Completed:Connect(function() if not isOpen then main.Visible = false end end) end end chatButton.MouseButton1Click:Connect(toggleChat) close.MouseButton1Click:Connect(toggleChat) -------------------------------------------------- -- MESSAGES CONTAINER -------------------------------------------------- local messages = Instance.new("ScrollingFrame") messages.Name = "Messages" messages.Position = UDim2.new(0, 8, 0, 48) messages.Size = UDim2.new(1, -16, 1, -94) messages.BackgroundTransparency = 1 messages.BorderSizePixel = 0 messages.ScrollBarThickness = 3 messages.ScrollBarImageColor3 = Color3.fromRGB(100, 100, 100) messages.AutomaticCanvasSize = Enum.AutomaticSize.Y messages.CanvasSize = UDim2.new(0, 0, 0, 0) messages.ZIndex = 21 messages.Parent = main local layout = Instance.new("UIListLayout") layout.Padding = UDim.new(0, 6) layout.SortOrder = Enum.SortOrder.LayoutOrder layout.Parent = messages -------------------------------------------------- -- CREATE MESSAGE FUNCTION -------------------------------------------------- local function createMessage(data) local msgText = tostring(data.Message or "") local font = Enum.Font.Gotham local textSize = 11 local textBounds = TextService:GetTextSize(msgText, textSize, font, Vector2.new(220, 1000)) local bubbleHeight = math.max(42, textBounds.Y + 24) local holder = Instance.new("Frame") holder.Size = UDim2.new(1, -4, 0, bubbleHeight) holder.BackgroundColor3 = Color3.fromRGB(22, 22, 26) holder.BackgroundTransparency = 0.1 holder.BorderSizePixel = 0 holder.ZIndex = 22 holder.Parent = messages local holderCorner = Instance.new("UICorner") holderCorner.CornerRadius = UDim.new(0, 8) holderCorner.Parent = holder -- Avatar local avatar = Instance.new("ImageLabel") avatar.Size = UDim2.new(0, 28, 0, 28) avatar.Position = UDim2.new(0, 6, 0, 6) avatar.BackgroundColor3 = Color3.fromRGB(35, 35, 35) avatar.BorderSizePixel = 0 avatar.ZIndex = 23 avatar.Parent = holder local avatarCorner = Instance.new("UICorner") avatarCorner.CornerRadius = UDim.new(1, 0) avatarCorner.Parent = avatar task.spawn(function() local success, image = pcall(function() return Players:GetUserThumbnailAsync( tonumber(data.UserId) or 1, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100 ) end) if success and avatar.Parent then avatar.Image = image end end) -- RGB Username local name = Instance.new("TextLabel") name.Position = UDim2.new(0, 40, 0, 4) name.Size = UDim2.new(1, -46, 0, 14) name.BackgroundTransparency = 1 name.Text = tostring(data.Name or "Unknown") name.Font = Enum.Font.GothamBold name.TextSize = 11 name.TextXAlignment = Enum.TextXAlignment.Left name.ZIndex = 24 name.Parent = holder task.spawn(function() local hue = math.random() while name.Parent do hue = (hue + 0.01) % 1 name.TextColor3 = Color3.fromHSV(hue, 0.9, 1) task.wait(0.04) end end) -- Message Text local text = Instance.new("TextLabel") text.Position = UDim2.new(0, 40, 0, 18) text.Size = UDim2.new(1, -46, 0, textBounds.Y + 2) text.BackgroundTransparency = 1 text.Text = msgText text.Font = font text.TextSize = textSize text.TextColor3 = Color3.fromRGB(230, 230, 230) text.TextWrapped = true text.TextXAlignment = Enum.TextXAlignment.Left text.TextYAlignment = Enum.TextYAlignment.Top text.ZIndex = 24 text.Parent = holder task.defer(function() messages.CanvasPosition = Vector2.new(0, messages.AbsoluteCanvasSize.Y) end) end -------------------------------------------------- -- INPUT FRAME & EMOJI POPUP SYSTEM -------------------------------------------------- local inputFrame = Instance.new("Frame") inputFrame.Position = UDim2.new(0, 8, 1, -38) inputFrame.Size = UDim2.new(1, -16, 0, 30) inputFrame.BackgroundColor3 = Color3.fromRGB(18, 18, 22) inputFrame.ZIndex = 30 inputFrame.Parent = main local inputCorner = Instance.new("UICorner") inputCorner.CornerRadius = UDim.new(0, 8) inputCorner.Parent = inputFrame -- Emoji Button local emojiBtn = Instance.new("TextButton") emojiBtn.Name = "EmojiButton" emojiBtn.Position = UDim2.new(0, 4, 0, 3) emojiBtn.Size = UDim2.new(0, 24, 0, 24) emojiBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 38) emojiBtn.Text = "😊" emojiBtn.TextSize = 12 emojiBtn.ZIndex = 32 emojiBtn.Parent = inputFrame local emojiBtnCorner = Instance.new("UICorner") emojiBtnCorner.CornerRadius = UDim.new(0, 5) emojiBtnCorner.Parent = emojiBtn -- Text Box local input = Instance.new("TextBox") input.Name = "MessageBox" input.Position = UDim2.new(0, 32, 0, 0) input.Size = UDim2.new(1, -62, 1, 0) input.BackgroundTransparency = 1 input.PlaceholderText = "Type a message..." input.PlaceholderColor3 = Color3.fromRGB(120, 120, 130) input.Text = "" input.TextColor3 = Color3.new(1, 1, 1) input.TextSize = 11 input.Font = Enum.Font.Gotham input.ClearTextOnFocus = false input.TextXAlignment = Enum.TextXAlignment.Left input.ZIndex = 31 input.Parent = inputFrame -- Send Button local sendBtn = Instance.new("TextButton") sendBtn.Name = "SendButton" sendBtn.Position = UDim2.new(1, -26, 0, 3) sendBtn.Size = UDim2.new(0, 22, 0, 24) sendBtn.BackgroundColor3 = Color3.fromRGB(45, 120, 240) sendBtn.Text = "➤" sendBtn.Font = Enum.Font.GothamBold sendBtn.TextSize = 11 sendBtn.TextColor3 = Color3.new(1, 1, 1) sendBtn.ZIndex = 32 sendBtn.Parent = inputFrame local sendCorner = Instance.new("UICorner") sendCorner.CornerRadius = UDim.new(0, 5) sendCorner.Parent = sendBtn -------------------------------------------------- -- EMOJI SELECTION POPUP PANEL -------------------------------------------------- local emojiPanel = Instance.new("Frame") emojiPanel.Name = "EmojiPanel" emojiPanel.Position = UDim2.new(0, 8, 1, -85) emojiPanel.Size = UDim2.new(0, 160, 0, 42) emojiPanel.BackgroundColor3 = Color3.fromRGB(22, 22, 28) emojiPanel.BorderSizePixel = 0 emojiPanel.Visible = false emojiPanel.ZIndex = 40 emojiPanel.Parent = main local emojiPanelCorner = Instance.new("UICorner") emojiPanelCorner.CornerRadius = UDim.new(0, 8) emojiPanelCorner.Parent = emojiPanel local emojiPanelStroke = Instance.new("UIStroke") emojiPanelStroke.Thickness = 1 emojiPanelStroke.Color = Color3.fromRGB(60, 60, 80) emojiPanelStroke.Parent = emojiPanel local emojiGrid = Instance.new("UIGridLayout") emojiGrid.CellSize = UDim2.new(0, 24, 0, 24) emojiGrid.CellPadding = UDim2.new(0, 4, 0, 4) emojiGrid.SortOrder = Enum.SortOrder.LayoutOrder emojiGrid.Parent = emojiPanel local emojiPadding = Instance.new("UIPadding") emojiPadding.PaddingLeft = UDim.new(0, 5) emojiPadding.PaddingTop = UDim.new(0, 9) emojiPadding.Parent = emojiPanel local emojiList = {"❤️", "😂", "🔥", "👍", "👑"} for _, emoji in ipairs(emojiList) do local b = Instance.new("TextButton") b.Text = emoji b.TextSize = 13 b.BackgroundColor3 = Color3.fromRGB(32, 32, 40) b.ZIndex = 41 b.Parent = emojiPanel local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 4) c.Parent = b b.MouseButton1Click:Connect(function() input.Text = input.Text .. emoji emojiPanel.Visible = false end) end emojiBtn.MouseButton1Click:Connect(function() emojiPanel.Visible = not emojiPanel.Visible end) -------------------------------------------------- -- SEND MESSAGE LOGIC -------------------------------------------------- local function sendMessage() local msg = input.Text if msg and msg:gsub("%s+", "") ~= "" then input.Text = "" emojiPanel.Visible = false if remote then remote:FireServer(msg) else createMessage({ UserId = player.UserId, Name = player.DisplayName, Message = msg }) end end end sendBtn.MouseButton1Click:Connect(sendMessage) input.FocusLost:Connect(function(enterPressed) if enterPressed then sendMessage() end end) -------------------------------------------------- -- LISTEN TO BROADCAST FROM SERVER -------------------------------------------------- if remote then remote.OnClientEvent:Connect(function(data) if type(data) == "table" then createMessage(data) end end) end