Class
ExperienceNotificationService
NotCreatableServiceNotReplicated
Service containing methods to validate users and prompt them to enable experience notifications.
Experience notifications are a way for 13+ users to keep up with their favorite experiences through timely, personalized notifications. This service contains methods to validate users and prompt them to enable notifications.
Methods 2#
| CanPromptOptInAsync | Indicates whether the local player can be prompted to enable notifications.Yields |
| PromptOptIn | Shows an in-experience prompt for the local player to enable notifications. |
CanPromptOptInAsync(): boolean#
Yields
CanPromptOptInAsync()
returns true if the local player can be prompted to enable
notifications. You should always use the result of this method before
calling PromptOptIn()
since the ability to be prompted depends on various factors like the
player's age or whether they've already enabled notifications for your
experience.
This method always infers the local player
(Players.LocalPlayer) and it can only be called from a
LocalScript or from a Script with
RunContext set to
Client. It should also be called in a
pcall() since it's an asynchronous network call
that may occasionally fail.
See Experience notifications for more details on implementing and customizing notifications, using launch data, and more.
Returns
boolean— Whether the local player can be prompted to enable notifications.
PromptOptIn(): ()#
PromptOptIn() prompts
the local player to enable notifications through an in-experience modal.
You should always use the result of
CanPromptOptInAsync()
before calling this method since the ability to be prompted depends on
various factors like the player's age or whether they've already enabled
notifications for your experience.
This method always infers the local player
(Players.LocalPlayer) and it can only be called from a
LocalScript or from a Script with
RunContext set to
Client.
See Experience notifications for more details on implementing and customizing notifications, using launch data, and more.
Returns
()
Events 1#
| OptInPromptClosed | Fires when the local player closes the prompt. |
OptInPromptClosed()#
This event fires when the local player closes a prompt that was displayed
through PromptOptIn().
It can only be connected in a LocalScript or in a Script
with RunContext set to
Client.
See Experience notifications for more details on implementing and customizing notifications, using launch data, and more.
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild