How to make custom notifications

How would I make a custom notifications system?
Message appears, if same message gets displayed twice it says (Message Goes Here) x2.
Or if a new message appears, the old message goes up and the message is on the bottom, like this:
image

Any examples would be appreciated.

1 Like

You can check if the string is exactly equal to the other

print("E" == "E")
--> true
print("Ea" == "E")
--> false

So with this, we can do this:

local strings = {"Hello!", "Hello!", "Hello!"} -- Add Strings here

function CheckString(str: string)
    local stringCount = 1 -- so we can count strings
    for i,v in strings do -- iterates through Array
        if str == v then -- if string is exactly equal to string
            stringCount += 1 -- Add to Count
        end -- ends if statement
    end -- ends for loop
    if stringCount > 1 then -- if count is greater than 1
        return string.format(str.." (x%d)", stringCount) -- Ex: "Hello! (x3)"
    else -- if number is less than 1
        return str -- return the plain string
    end
    
end

local Current = CheckString("Hello!")
print(Current) -- "Hello! (x3)"
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.