Tutorial - How to set up notifications

Notice!

This post is really old, and I was pretty new when I made it
The code for this is a mess and you should probably be using what alexinite instead of what I said

How to set up notifications

Note: If you already have a gui skip steps 1-4

1: Open "Roblox Studio

2: Select “Baseplate”

3: Click “StarterGui”

4: Create a “ScreenGui” in it.

5: Create and map out over 1 textlabel(s) and also name each textlabel with “m”(for example) and a different number

6: Add a new folder and name it whatever you want

7: Add another folder folder and name it whatever you want(for the textlabel(s))

8: Move all the textlabel(s) in to the folder you just created

9: Create a script and have this data in it:

–the event is optional
game.ReplicatedStorage.MCMDA.Event:Connect(function(msg, color3)
local val = #script.Parent.–your first folder name–:GetChildren()

if script.Parent--your second folder name--:FindFirstChild("--txextlabels name without number--"..val) == nil then
	wait()
	script.Parent.--your first folder name--:ClearAllChildren()
	for i, v in pairs(script.Parent.--your second folder name--:GetChildren()) do
		v.Text = ""
	end
	script.Parent.--txextlabel's name without number--.1.Text = msg
	script.Parent.--txextlabel's name without number--1.TextColor3 = color3
	
	Instance.new("StringValue", script.Parent.--your first folder name--)

else
	local ting = script.Parent.--your second folder name--:FindFirstChild("m"..val)
	if ting then
		ting.Text = msg
		ting.TextColor3 = color3
		Instance.new("StringValue", script.Parent.--your first folder name--)
		wait(5)
        ting.Text = ""
	end
end

end)

replace all the ---- to what they tell you to replace to

and you should get this:
tutorial

34 Likes

Interesting, this will come in handy for some of my projects. Bookmarked!

3 Likes

Thank you so much for your feedback :heart:

1 Like

I’ll give a fast and easy response.

game:GetService'StarterGui':SetCore('SendNotification', {
  Title = 'Notification',
  Text = 'Test',
  Duration = 5
})

StarterGui:SetCore

The work you’re putting into this is unnecessary for what you’re trying to do. The folders are useless, values being created for nothing, etc. If you wan’t a non-core way of doing this I recommend Tables and Coroutines.

I’ll follow up with an example when I make one*

16 Likes

Some might be but the textlabel folder is important

Follow up: Here’s what I did.

-- ModuleScript in StarterGui
local PlayerGui, TweenService = script.Parent, game:GetService'TweenService'
local Create = {}

local ScreenGui = 'TextGui'
function Create:AddText(Text)
  local TempScreen, Body
  if PlayerGui:FindFirstChild(ScreenGui) == nil then
    TempScreen = Instance.new('ScreenGui', PlayerGui)
    TempScreen.Name, Body = ScreenGui, Instance.new('Frame', TempScreen)
    Body.AnchorPoint, Body.BackgroundTransparency, Body.Position, Body.Size = Vector2.new(.5,1), 1, UDim2.new(.5,0,1,-15), UDim2.new(1,0,.25,0)
    local List = Instance.new('UIListLayout', Body)
    List.HorizontalAlignment, List.VerticalAlignment = 'Center', 'Bottom'
  else
    TempScreen = PlayerGui:FindFirstChild(ScreenGui)
    Body = TempScreen:WaitForChild'Frame'
  end
  local TextLabel = Instance.new('TextLabel', Body)
  TextLabel.BackgroundColor3, TextLabel.BackgroundTransparency, TextLabel.Font, TextLabel.Text, TextLabel.TextSize, TextLabel.TextColor3, TextLabel.TextStrokeColor3, TextLabel.TextStrokeTransparency = Color3.fromRGB(156, 237, 255), .5, Enum.Font.Cartoon, Text, 30, Color3.new(1,1,1), Color3.new(.5, .5, .5), .75
   TextLabel.Size = UDim2.new(0,0,0,0)
   local UICorner = Instance.new('UICorner', TextLabel)
   UICorner.CornerRadius = UDim.new(.2,0)
   TweenService:Create(TextLabel, TweenInfo.new(.1), {
     Size = UDim2.new(.02, 5 + TextLabel.TextBounds.X, .02, 5 + TextLabel.TextBounds.Y) -- make it POP
    }):Play()
    delay(1.1 + (#Text / 4), function() -- "Hello World" would take ~3 seconds
      TweenService:Create(TextLabel, TweenInfo.new(2), {
        TextStrokeTransparency = 1,
        TextTransparency = 1,
        BackgroundTransparency = 1 -- awh good bye : (
      }):Play()
      delay(2, function()
        TextLabel:Destroy()
       end)
     end)
   end

return Create

Simple to use, just make this a ModuleScript and put it in PlayerGui. You use it like the following:

local Module = require(game.Players.LocalPlayer.PlayerGui.ModuleScript)
Module:AddText("Hello World!")
Module:AddText("How are you today?")

17 Likes

hey how come it says that msg is an unknown global

its because you probably removed the event and msg does not exist

Oh lord, those comments in your script, really freak me out.

PSA: You might want to use .OnClientEvent:Connect(function(Msg, Color3) instead of that one you mentioned.
PSA2: You misspelled textlabel, you spelled it as txextlabel.

Here’s a “probably better” solution to this

Gui:
Create a frame that is used to hold the notifications, put a UIListLayout, and set padding’s offset to 15, set the FillDirection to vertical, and set VerticalAlignment to bottom.

Script:
With the use of UIListLayout, the script will be, very simple.

local Holder = script.Parent.Holder

local function MakeMessage(Args)
    local Message = script.Message:Clone() -- pretend that there's a TextLabel called Message inside this script

    Message.Text = Args.Text

    for i,v in pairs(Holder:GetChildren()) do
        if v:IsA("Frame") then
            v.ZIndex += 1 -- Compound assignment, recently added
        end
    end

    Message.Parent = Holder
    Message.ZIndex = 0 -- So the message will appear at the most bottom!

    -- Dismiss notification after a few seconds (wrapped inside a spawn)
    spawn(function()
        wait(5)
        Message:Destroy()
    end)
end

-- Example code
MakeMessage({Text = "Hello World!"})

(Oh yeah, I forgot to use TextService:GetTextSize() to prevent some issue with lengthy text)

The function named MakeMessage is to make a message and all of the stuff will be done in that function!

Good luck.

4 Likes

How do you make the notification images rounded? For example, I use the Headshot Thumbnail of player’s profiles for the notifications when they join the game. But the image isn’t rounded.

create a UIcorner onto it is probably the easiest solution

It’s not a gui so you can’t use a UI corner on it. It’s made using a script so I need to know how to make it rounded with a script.

Hey, this post is getting traction again!
This post is really old, and I was pretty new when I made it
The code for this is a mess and you should probably be using what alexinite instead of what I said