Chat Seperator
Key RequiredUniversal

Chat Seperator

Universal Scriptareyoumental110areyoumental110 27.9K views 258 executesUpdated Oct 28, 2024
Unrated
00
Lua Script•143 lines (4266 chars)
-- i hate string manipulation, causes headaches every time
function findlast(str,fstr)
    local rstr = string.reverse(str)
    local rfstr = string.reverse(fstr)
    local fstart,fend = string.find(rstr,rfstr)
    local rfstart,rfend = (string.len(str)-fend)+1,(string.len(str)-fstart)+1
    return rfstart,rfend
end
function splitwords(txt,stopatwordends,chrcap)
    local amttodo = string.len(txt)/chrcap
    local amt = 0
    local rettable = {}
    local tr = true
    while tr do
        local oldamt = amt
        if amttodo < 1 then
            amt = amt + amttodo*chrcap
        else
            amt = amt + chrcap
        end
        local newtxt = string.sub(txt,oldamt,amt)
        if stopatwordends and amttodo > 1 then
            local pos = findlast(newtxt," ")
            if pos then
                newtxt = string.sub(newtxt,oldamt,pos)
            end
        end
        if string.len(newtxt) > 0 then
            table.insert(rettable,newtxt)
        end
        amttodo = amttodo - 1
        if amttodo <= 0 then
            tr = false
        end
    end
    return rettable
end
function gettable(txt,chrcap,stopatwordends,newlines)
    if chrcap == nil then
        chrcap = 199
    end
    if stopatwordends == nil then
        stopatwordends = false
    end
    if newlines == nil then
        newlines = true
    end
    local rettable = {}
    if newlines and #string.split(txt,"\n") > 1 then
        for i,v in pairs(string.split(txt,"\n")) do
            if v ~= nil and v ~= "" then
                if string.len(v) > chrcap then
                    local spltable = splitwords(v,stopatwordends,chrcap)
                    for i,v in pairs(spltable) do
                        table.insert(rettable,v)
                    end
                else
                    table.insert(rettable,v)
                end
            end
        end
    else
        if string.len(txt) > chrcap then
            local spltable = splitwords(txt,stopatwordends,chrcap)
            for i,v in pairs(spltable) do
                table.insert(rettable,v)
            end
        else
            table.insert(rettable,txt)
        end
    end
    return rettable
end
local textservice = game:GetService("TextService")
local textcservice = game:GetService("TextChatService")
function say(txt,channel)
    local success,err = pcall(function()
        if textcservice.ChatVersion == Enum.ChatVersion.TextChatService then
            textcservice:FindFirstChildWhichIsA("ChatInputBarConfiguration").TargetTextChannel:SendAsync(txt)
        else
            game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(txt,channel or "All")
        end
    end)
end
local ot = false
pcall(function()
    local Notify = function(_Title, _Text , Time)
        game.StarterGui:SetCore("SendNotification", {Title = _Title, Text = _Text, Icon = "rbxassetid://2541869220", Duration = Time})
    end
    local Metatable = getrawmetatable(game.StarterGui)
    setreadonly(Metatable, false)
    local event = require(localplr.PlayerScripts:FindFirstChild("ChatMain",true)).MessagePosted
    local oldfunc
    oldfunc = hookfunction(event.fire,function(a1,a2,a3)
        local args = {a1,a2,a3}
        if ot and args[1] == event then
            return nil
        else
            return oldfunc(table.unpack(args))
        end
    end)
end)
local ids = {}
local idnum = 0
function saytable(tab,delay,antichatlog)
    if antichatlog == nil then
        antichatlog = true
    end
    if delay == nil then
        delay = 5
    end
    if antichatlog then
        ot = true
    end
    idnum = idnum + 1
    local currid = idnum
    ids[currid] = true
    coroutine.wrap(function()
        for i,v in pairs(tab) do
            if ids[currid] == false then
                continue
            end
            local saytxt = v
            say(saytxt)
            wait(delay)
        end
        if antichatlog then
            ot = false
        end
    end)()
    return currid
end
function stopsaying(id)
    ids[id] = false
end
local rettable = {}
rettable.getmessages = gettable
rettable.saymessages = saytable
rettable.say = say
rettable.splitwords = splitwords
rettable.findlast = findlast
rettable.stopsaying = stopsaying
return rettable

Features & Information

Splits any text you insert into a table which you can use to say the text under the chat limit how to use: -- get the script and define it as a variable like this: local txtsep = loadstring(game:HttpGet("https://rawscripts.net/raw/Universal-Script-Chat-Seperator-21154"))() -- use the function "getmessages" to get the table of messages (that is all seperated) local tosay = txtsep.getmessages("hello") -- theres some other stuff you can customize about the function ofc -- txtsep.getmessages(txthere (string),charactercap (number),stopatwordendings (bool)) -- stopatwordendings just means the splitted text will "erase" some text so the full thing stops at an ending of a word (the erased part will still be there at the next part of the text) -- now that you got your table, you can either make a script that says them or use the "built in" function of saying them local id = txtsep.saymessages(tosay) -- more customizable stuff is there too -- txtsep.saymessages(tosay (table),delay (number),antichatlog (bool)) -- the delay is how much it waits until saying the next message -- the anti chat log turns the anti chat log on when its saying stuff (by anthony) -- and the function also returns an id which u can use with "stopsaying" to make it stop saying the text txtsep.stopsaying(id) If you want to support me, go through this linkvertise https://link-target.net/1262127/support-me
#Chat#Seperator#Split#Splitter#Text

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts