local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local UIS = game:GetService("UserInputService") local player = Players.LocalPlayer local remote = ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("GlobalMessage") -- GUI local gui = Instance.new("ScreenGui") gui.Name = "GlobalChatGui" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 260, 0, 170) frame.Position = UDim2.new(0, 100, 0.6, 0) frame.BackgroundColor3 = Color3.fromRGB(30,30,30) frame.BorderSizePixel = 0 frame.Active = true frame.Parent = gui -- title bar (drag area) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 25) title.BackgroundColor3 = Color3.fromRGB(20,20,20) title.Text = "Global Chat" title.TextColor3 = Color3.new(1,1,1) title.Font = Enum.Font.SourceSansBold title.TextSize = 18 title.Parent = frame -- textbox local box = Instance.new("TextBox") box.Size = UDim2.new(1, -20, 0, 35) box.Position = UDim2.new(0, 10, 0, 35) box.PlaceholderText = "Enter message..." box.Text = "" box.ClearTextOnFocus = false box.BackgroundColor3 = Color3.fromRGB(45,45,45) box.TextColor3 = Color3.new(1,1,1) box.Parent = frame -- color preview local preview = Instance.new("Frame") preview.Size = UDim2.new(0, 40, 0, 40) preview.Position = UDim2.new(1, -50, 0, 80) preview.BackgroundColor3 = Color3.new(1,1,1) preview.BorderSizePixel = 0 preview.Parent = frame -- RGB sliders local function createSlider(name, y) local label = Instance.new("TextLabel") label.Size = UDim2.new(0, 20, 0, 20) label.Position = UDim2.new(0, 10, 0, y) label.Text = name label.BackgroundTransparency = 1 label.TextColor3 = Color3.new(1,1,1) label.Parent = frame local slider = Instance.new("TextBox") slider.Size = UDim2.new(0, 50, 0, 20) slider.Position = UDim2.new(0, 30, 0, y) slider.Text = "255" slider.BackgroundColor3 = Color3.fromRGB(50,50,50) slider.TextColor3 = Color3.new(1,1,1) slider.Parent = frame return slider end local rBox = createSlider("R", 80) local gBox = createSlider("G", 105) local bBox = createSlider("B", 130) -- send button local send = Instance.new("TextButton") send.Size = UDim2.new(0, 80, 0, 30) send.Position = UDim2.new(1, -90, 1, -35) send.Text = "Send" send.BackgroundColor3 = Color3.fromRGB(60,60,60) send.TextColor3 = Color3.new(1,1,1) send.Parent = frame -- update color preview local currentColor = Color3.new(1,1,1) local function updateColor() local r = tonumber(rBox.Text) or 255 local g = tonumber(gBox.Text) or 255 local b = tonumber(bBox.Text) or 255 r = math.clamp(r,0,255) g = math.clamp(g,0,255) b = math.clamp(b,0,255) currentColor = Color3.fromRGB(r,g,b) preview.BackgroundColor3 = currentColor end rBox.FocusLost:Connect(updateColor) gBox.FocusLost:Connect(updateColor) bBox.FocusLost:Connect(updateColor) updateColor() -- send message (TEXT DOES NOT DELETE) send.MouseButton1Click:Connect(function() local text = box.Text if text ~= "" then local args = { text, currentColor } remote:FireServer(unpack(args)) end end) -- DRAG SYSTEM local dragging = false local dragStart local startPos title.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragStart = input.Position startPos = frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) UIS.InputChanged:Connect(function(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then local delta = input.Position - dragStart frame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end)