rojo/.cursor/rules/roblox/reference/engine/classes/ExperienceNotificationService.yaml
2026-02-02 12:08:47 -06:00

121 lines
4.6 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: ExperienceNotificationService
type: class
memory_category: Instances
summary: |
Service containing methods to validate users and prompt them to enable
experience notifications.
description: |
[Experience notifications](../../../production/promotion/experience-notifications.md)
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.
code_samples: []
inherits:
- Instance
descendants: []
tags:
- NotCreatable
- Service
- NotReplicated
deprecation_message: ''
properties: []
methods:
- name: ExperienceNotificationService:CanPromptOptInAsync
summary: |
Indicates whether the local player can be prompted to enable
notifications.
description: |
`Class.ExperienceNotificationService:CanPromptOptInAsync()|CanPromptOptInAsync()`
returns `true` if the local player can be prompted to enable
notifications. You should always use the result of this method before
calling `Class.ExperienceNotificationService:PromptOptIn()|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
(`Class.Players.LocalPlayer`) and it can only be called from a
`Class.LocalScript` or from a `Class.Script` with
`Class.BaseScript.RunContext|RunContext` set to
`Enum.RunContext.Client|Client`. It should also be called in a
`Global.LuaGlobals.pcall|pcall()` since it's an asynchronous network call
that may occasionally fail.
See
[Experience notifications](../../../production/promotion/experience-notifications.md)
for more details on implementing and customizing notifications, using
launch data, and more.
code_samples:
- ExperienceNotificationService1
parameters: []
returns:
- type: boolean
summary: |
Whether the local player can be prompted to enable notifications.
tags:
- Yields
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: ExperienceNotificationService:PromptOptIn
summary: |
Shows an in-experience prompt for the local player to enable
notifications.
description: |
`Class.ExperienceNotificationService:PromptOptIn()|PromptOptIn()` prompts
the local player to enable notifications through an in-experience modal.
You should always use the result of
`Class.ExperienceNotificationService:CanPromptOptInAsync()|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
(`Class.Players.LocalPlayer`) and it can only be called from a
`Class.LocalScript` or from a `Class.Script` with
`Class.BaseScript.RunContext|RunContext` set to
`Enum.RunContext.Client|Client`.
See
[Experience notifications](../../../production/promotion/experience-notifications.md)
for more details on implementing and customizing notifications, using
launch data, and more.
code_samples:
- ExperienceNotificationService1
parameters: []
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
events:
- name: ExperienceNotificationService.OptInPromptClosed
summary: |
Fires when the local player closes the prompt.
description: |
This event fires when the local player closes a prompt that was displayed
through `Class.ExperienceNotificationService:PromptOptIn()|PromptOptIn()`.
It can only be connected in a `Class.LocalScript` or in a `Class.Script`
with `Class.BaseScript.RunContext|RunContext` set to
`Enum.RunContext.Client|Client`.
See
[Experience notifications](../../../production/promotion/experience-notifications.md)
for more details on implementing and customizing notifications, using
launch data, and more.
code_samples:
- ExperienceNotificationService1
parameters: []
tags: []
deprecation_message: ''
security: None
capabilities: []
callbacks: []