I would like to make a system, once a specified user joins server, people will receive a notification with his avatar icon and name and text “joined server”, what does it need?
What does it need?
- A PlayerAdded event in a server script that detects when a player joins and then checks their name to see if it’s the specific user
- Remote Event to fire
StarterGui:SetCore("SendNotification", {})
to all players - Use
Players:GetUserThumbnailAsync()
to get the player’s thumbnail, more info here: :GetUserThumbnail method
Those are the main things. Should be pretty easy to do.
It should be in a server-sided script or the script should be placed somewhere?
What exactly are you wanting the notifaction to be?
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local playerToWatch = "ItzCrime_bruh" -- replace with the name of the player you want to watch
function onPlayerAdded(player)
if player.Name == playerToWatch then
local notificationText = player.DisplayName .. " joined the game!"
local notificationOptions = {
Title = "Player Joined",
Text = notificationText,
Duration = 5,
}
StarterGui:SetCore("SendNotification", notificationOptions)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
EDIT: It may not work due to how roblox loads. If it doesnt work move it to a Starter Folder
If I wan’t to have my original name (not display), I just gotta change this to player.Name
?
Yup. That should work fine. Do you still want an Icon next to the text?
uh yeah yrf jghjcfmrdlcf;v’
Alright!
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local playerToWatch = "ItzCrime_bruh" -- replace with the name of the player you want to watch
function onPlayerAdded(player)
if player.Name == playerToWatch then
local notificationText = player.Name .. " joined the game!"
local thumbnailType = Enum.ThumbnailType.HeadShot
local thumbnailSize = Enum.ThumbnailSize.Size420x420
local thumbnailUrl = game:GetService("Players"):GetUserThumbnailAsync(player.UserId, thumbnailType, thumbnailSize)
local notificationOptions = {
Title = "Player Joined",
Text = notificationText,
Duration = 5,
Icon = thumbnailUrl,
}
StarterGui:SetCore("SendNotification", notificationOptions)
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
Alright, thanks. Also, there is any chance to make a small text under the name?
Awesome! If it worked please solution it. Also Can you elaborate?
he’s talking about the property called “Text”…
Modifying
local notificationText = player.Name .. " joined the game!"
You can modify it to your liking
local notificationText = player.Name .. " joined the game"!
under this text
“Title” and “Text” is the only text you can have on it?
ok thanks i guess this will work, let me test it real quic
by the way, where do i put this script, and what type it should be local or normal? im not professional in types
Most likely a server script inside of server script service…
Didn’t you type the code,
it’s probably the only two
Its in a LocalScript. CoreGui can only be called by the client