SendNotification (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>ArceusInator No edit summary |
m Text replacement - "</SyntaxHighlight>" to "</syntaxhighlight>" Tags: mobile web edit mobile edit |
||
(14 intermediate revisions by 7 users not shown) | |||
Line 2: | Line 2: | ||
{{Method | {{Method | ||
|name=SendNotification | |name=SendNotification | ||
|description=Sends a notification through the [[GuiService]] which then creates a [[NotificationBox]] inside of | |description=Sends a notification through the [[GuiService]] which then creates a [[NotificationBox]] inside of {{`|game.CoreGui.RobloxGui.ControlFrame.NotificationBox}} to match your arguments. | ||
|protected=Yes | |protected=Yes | ||
|arguments=[[String]] ''title'', [[String]] ''message'', [[Content]] ''picture'', [[Number]] ''timeout'', [[Function]] ''callback'' | |arguments=[[String]] ''title'', [[String]] ''message'', [[Content]] ''picture'', [[Number]] ''timeout'', [[Function]] ''callback'' | ||
|object=GuiService}} | |object=GuiService}} | ||
{{clear floats}} | |||
{{Example|If you're using the [[Command Bar]] or a [[CoreScript]]... | {{Example|If you're using the [[Command Bar]] or a [[CoreScript]]... | ||
< | <syntaxhighlight lang="lua"> | ||
local guiService = game:GetService("GuiService") | local guiService = game:GetService("GuiService") | ||
local title = "Title" | local title = "Title" | ||
Line 33: | Line 19: | ||
guiService:SendNotification(title, message, picture, timeout, callback) | guiService:SendNotification(title, message, picture, timeout, callback) | ||
</ | </syntaxhighlight> | ||
Would send something like this: | Would send something like this: | ||
[[Image:Notification.png|195px|center]] | [[Image:Notification.png|195px|center]] | ||
Line 41: | Line 27: | ||
---- | ---- | ||
If you're using a [[Script]] or a [[LocalScript]]... | If you're using a [[Script]] or a [[LocalScript]]... | ||
< | <syntaxhighlight lang="lua"> | ||
local guiService = game:GetService("GuiService") | local guiService = game:GetService("GuiService") | ||
local title = "Title" | local title = "Title" | ||
Line 49: | Line 35: | ||
local callback = function() print("Notification gone") end | local callback = function() print("Notification gone") end | ||
guiService:SendNotification(title, message, picture, timeout, callback) --> Unknown exception</ | guiService:SendNotification(title, message, picture, timeout, callback) --> Unknown exception</syntaxhighlight> | ||
}} | }} | ||
*NOTE: Currently used by ROBLOX to send friend requests and to change the graphics quality. |
Latest revision as of 06:14, 27 April 2023
Protected:This item is protected. Attempting to use it in a Script or LocalScript will cause an error.
SendNotification( String title, String message, Content picture, Number timeout, Function callback ) | |
Returns | nil |
Description: | Sends a notification through the GuiService which then creates a NotificationBox inside of game.CoreGui.RobloxGui.ControlFrame.NotificationBox to match your arguments. |
Member of: | GuiService |
Example
If you're using the Command Bar or a CoreScript...
local guiService = game:GetService("GuiService")
local title = "Title"
local message = "Message"
local picture = "rbxasset://textures/Help_ovr.png"
local timeout = 10
local callback = function() print("Notification gone") end
guiService:SendNotification(title, message, picture, timeout, callback)
Would send something like this:
And then print "Notification gone" in 10 seconds or when it's clicked.
If you're using a Script or a LocalScript...
local guiService = game:GetService("GuiService")
local title = "Title"
local message = "Message"
local picture = "rbxasset://textures/Help_ovr.png"
local timeout = 10
local callback = function() print("Notification gone") end
guiService:SendNotification(title, message, picture, timeout, callback) --> Unknown exception
- NOTE: Currently used by ROBLOX to send friend requests and to change the graphics quality.