Vihaan Secret Chat
Key Required

Vihaan Secret Chat

Brookhaven 🏡RPvihaaaaaanvihaaaaaan 78 views 26 executesUpdated Jul 16, 2026
Unrated
00
Lua Script•240 lines (9044 chars)
-- Vihaan Secret Chat (The Ultimate Edition)
-- Fully Optimized & Cleaned

local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

-- Clean up any legacy instances to avoid duplication lag
local existingGui = PlayerGui:FindFirstChild("VihaanSecretGui")
if existingGui then existingGui:Destroy() end

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "VihaanSecretGui"
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = PlayerGui

----------------------------------------------------
-- 1. UTILITY: RAINBOW GENERATOR
----------------------------------------------------
local function makeRainbowText(text)
    local colors = {
        "rgb(255, 0, 0)", "rgb(255, 127, 0)", "rgb(255, 255, 0)",
        "rgb(0, 255, 0)", "rgb(0, 200, 255)", "rgb(0, 0, 255)", "rgb(139, 0, 255)"
    }
    local formattedText = ""
    for i = 1, #text do
        local character = string.sub(text, i, i)
        if character == " " then
            formattedText = formattedText .. " "
        else
            local color = colors[((i - 1) % #colors) + 1]
            formattedText = formattedText .. string.format("<font color='%s'>%s</font>", color, character)
        end
    end
    return formattedText
end

local rainbowStarTag = makeRainbowText("[STAR:] ")

-- Optimized Rainbow Loop
local function applyRainbowLoop(uiInstance, property)
    task.spawn(function()
        local hue = 0
        while uiInstance and uiInstance.Parent do
            hue = (hue + 1) % 360
            local color = Color3.fromHSV(hue / 360, 0.8, 1)
            uiInstance[property] = color
            RunService.RenderStepped:Wait()
        end
    end)
end

----------------------------------------------------
-- 2. CORE CHAT OVERRIDE
----------------------------------------------------
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
    local properties = Instance.new("TextChatMessageProperties")
    if message.TextSource then
        local sender = Players:GetPlayerByUserId(message.TextSource.UserId)
        if sender == LocalPlayer then
            local displayName = sender.DisplayName
            local rainbowName = makeRainbowText(displayName)
            properties.PrefixText = rainbowStarTag .. rainbowName
        end
    end
    return properties
end

----------------------------------------------------
-- 3. THE NOTE TAB (WINDOW)
----------------------------------------------------
local function createNoteWindow()
    -- Main Window Frame
    local NoteFrame = Instance.new("Frame")
    NoteFrame.Name = "NoteFrame"
    NoteFrame.Size = UDim2.new(0, 340, 0, 180)
    NoteFrame.Position = UDim2.new(0.5, -170, 0.5, -90)
    NoteFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
    NoteFrame.BorderSizePixel = 0
    NoteFrame.ClipsDescendants = true
    NoteFrame.Active = true
    NoteFrame.Draggable = true
    NoteFrame.Parent = ScreenGui

    local MainCorner = Instance.new("UICorner")
    MainCorner.CornerRadius = UDim.new(0, 10)
    MainCorner.Parent = NoteFrame

    -- Rainbow Stroke Outer Border
    local Border = Instance.new("UIStroke")
    Border.Thickness = 2.5
    Border.Parent = NoteFrame
    applyRainbowLoop(Border, "Color")

    -- Top Header Bar
    local TopBar = Instance.new("Frame")
    TopBar.Size = UDim2.new(1, 0, 0, 30)
    TopBar.BackgroundTransparency = 1
    TopBar.Parent = NoteFrame

    -- Minimized Title Header (Black cursive text)
    local MinimizedTitle = Instance.new("TextLabel")
    MinimizedTitle.Size = UDim2.new(1, -80, 1, 0)
    MinimizedTitle.Position = UDim2.new(0, 12, 0, 0)
    MinimizedTitle.BackgroundTransparency = 1
    MinimizedTitle.Font = Enum.Font.Bodoni
    MinimizedTitle.TextSize = 16
    MinimizedTitle.TextColor3 = Color3.fromRGB(15, 15, 15)
    MinimizedTitle.TextXAlignment = Enum.TextXAlignment.Left
    MinimizedTitle.Text = "<i>VIHAAN SECRET CHAT</i>"
    MinimizedTitle.TextTransparency = 1
    MinimizedTitle.Parent = TopBar

    -- Minimize Button (-)
    local MinButton = Instance.new("TextButton")
    MinButton.Size = UDim2.new(0, 22, 0, 22)
    MinButton.Position = UDim2.new(1, -55, 0, 4)
    MinButton.BackgroundTransparency = 1
    MinButton.Text = "–"
    MinButton.Font = Enum.Font.GothamBold
    MinButton.TextSize = 18
    MinButton.Parent = TopBar
    applyRainbowLoop(MinButton, "TextColor3")

    -- Close Button (✕)
    local CloseButton = Instance.new("TextButton")
    CloseButton.Size = UDim2.new(0, 22, 0, 22)
    CloseButton.Position = UDim2.new(1, -28, 0, 4)
    CloseButton.BackgroundTransparency = 1
    CloseButton.Text = "✕"
    CloseButton.Font = Enum.Font.GothamBold
    CloseButton.TextSize = 14
    CloseButton.Parent = TopBar
    applyRainbowLoop(CloseButton, "TextColor3")

    -- Body Message (Cursive black body text)
    local MessageText = Instance.new("TextLabel")
    MessageText.Size = UDim2.new(1, -24, 1, -45)
    MessageText.Position = UDim2.new(0, 12, 0, 32)
    MessageText.BackgroundTransparency = 1
    MessageText.Font = Enum.Font.Bodoni
    MessageText.TextSize = 17
    MessageText.TextColor3 = Color3.fromRGB(15, 15, 15)
    MessageText.TextWrapped = true
    MessageText.RichText = true
    MessageText.Text = "<i><b>WELCOME TO VIHAAN SECRET CHAT💫</b><br/><br/>TYPE ANYTHING IN THE CHAT IT WILL BE ONLY VISIBLE TO YOU AND WHO WILL OPEN THE SCRIPT💫</i>"
    MessageText.Parent = NoteFrame

    -- Precise Minimize Logic (No overlapping possible)
    local minimized = false
    local originalSize = NoteFrame.Size
    
    MinButton.MouseButton1Click:Connect(function()
        minimized = not minimized
        if minimized then
            -- Immediately shut off visibility to avoid text overlapping
            MessageText.Visible = false
            
            -- Minimize animation
            TweenService:Create(NoteFrame, TweenInfo.new(0.3, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Size = UDim2.new(0, 340, 0, 30)}):Play()
            TweenService:Create(MinimizedTitle, TweenInfo.new(0.2), {TextTransparency = 0}):Play()
            MinButton.Text = "+"
        else
            -- Expand animation
            TweenService:Create(NoteFrame, TweenInfo.new(0.3, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Size = originalSize}):Play()
            TweenService:Create(MinimizedTitle, TweenInfo.new(0.2), {TextTransparency = 1}):Play()
            
            -- Safely make body text visible after the frame starts expanding
            task.delay(0.15, function()
                if not minimized then
                    MessageText.Visible = true
                end
            end)
            MinButton.Text = "–"
        end
    end)

    -- Close Window Button Action
    CloseButton.MouseButton1Click:Connect(function()
        NoteFrame:Destroy()
    end)
    
    -- Smooth Scale Intro Pop-in 
    NoteFrame.Size = UDim2.new(0, 0, 0, 0)
    NoteFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
    TweenService:Create(NoteFrame, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
        Size = originalSize,
        Position = UDim2.new(0.5, -170, 0.5, -90)
    }):Play()
end

----------------------------------------------------
-- 4. HORROR INTRO PIPELINE
----------------------------------------------------
local function createHorrorIntro()
    local blackFrame = Instance.new("Frame")
    blackFrame.Size = UDim2.new(1, 0, 1, 0)
    blackFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
    blackFrame.BorderSizePixel = 0
    blackFrame.Parent = ScreenGui

    local horrorLabel = Instance.new("TextLabel")
    horrorLabel.Size = UDim2.new(0.8, 0, 0.2, 0)
    horrorLabel.Position = UDim2.new(0.1, 0, 0.4, 0)
    horrorLabel.BackgroundTransparency = 1
    horrorLabel.Font = Enum.Font.Creepster
    horrorLabel.TextColor3 = Color3.fromRGB(180, 0, 0)
    horrorLabel.TextSize = 50
    horrorLabel.TextWrapped = true
    horrorLabel.TextXAlignment = Enum.TextXAlignment.Center
    horrorLabel.TextYAlignment = Enum.TextYAlignment.Center
    horrorLabel.Text = "VIHAAN SECRET CHAT LOADED 🇧🇷"
    horrorLabel.TextStrokeColor3 = Color3.fromRGB(40, 0, 0)
    horrorLabel.TextStrokeTransparency = 0.2
    horrorLabel.Parent = blackFrame

    task.wait(2) -- Precise 2 second lock

    local fadeTime = 0.5
    local fadeInfo = TweenInfo.new(fadeTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
    
    local tweenFrame = TweenService:Create(blackFrame, fadeInfo, {BackgroundTransparency = 1})
    local tweenText = TweenService:Create(horrorLabel, fadeInfo, {TextTransparency = 1, TextStrokeTransparency = 1})
    
    tweenFrame:Play()
    tweenText:Play()

    task.wait(fadeTime)
    
    -- Destroy the screen to save Roblox memory, then draw the note
    blackFrame:Destroy()
    createNoteWindow()
end

-- Fire the system script sequence!
task.spawn(createHorrorIntro)

Features & Information

Secret Chatttt
#SecretChat

Community Comments (0)

No comments yet for this script.

More Scripts for Brookhaven 🏡RP