Experience Notification Service
*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.
Tài Liệu Tham Khảo API
Phương Pháp
Can Prompt Opt In Async
Lợi Nhuận
Mẫu mã
LocalScript - Triển khai lời nhắc quyền thông báo
local ExperienceNotificationService = game:GetService("ExperienceNotificationService")
-- Hàm để kiểm tra xem người chơi có thể được nhắc để bật thông báo hay không
local function canPromptOptIn()
local success, canPrompt = pcall(function()
return ExperienceNotificationService:CanPromptOptInAsync()
end)
return success and canPrompt
end
local canPrompt = canPromptOptIn()
if canPrompt then
local success, errorMessage = pcall(function()
ExperienceNotificationService:PromptOptIn()
end)
if not success then
warn("Không thể nhắc bật thông báo:", errorMessage)
end
end
-- Lắng nghe sự kiện nhắc bật thông báo đã đóng
ExperienceNotificationService.OptInPromptClosed:Connect(function()
print("Nhắc bật thông báo đã đóng")
end)Prompt Opt In
Experience Notification Service: Prompt Opt In():()
Lợi Nhuận
()
Mẫu mã
LocalScript - Triển khai lời nhắc quyền thông báo
local ExperienceNotificationService = game:GetService("ExperienceNotificationService")
-- Hàm để kiểm tra xem người chơi có thể được nhắc để bật thông báo hay không
local function canPromptOptIn()
local success, canPrompt = pcall(function()
return ExperienceNotificationService:CanPromptOptInAsync()
end)
return success and canPrompt
end
local canPrompt = canPromptOptIn()
if canPrompt then
local success, errorMessage = pcall(function()
ExperienceNotificationService:PromptOptIn()
end)
if not success then
warn("Không thể nhắc bật thông báo:", errorMessage)
end
end
-- Lắng nghe sự kiện nhắc bật thông báo đã đóng
ExperienceNotificationService.OptInPromptClosed:Connect(function()
print("Nhắc bật thông báo đã đóng")
end)Sự Kiện
Opt In Prompt Closed
Mẫu mã
LocalScript - Triển khai lời nhắc quyền thông báo
local ExperienceNotificationService = game:GetService("ExperienceNotificationService")
-- Hàm để kiểm tra xem người chơi có thể được nhắc để bật thông báo hay không
local function canPromptOptIn()
local success, canPrompt = pcall(function()
return ExperienceNotificationService:CanPromptOptInAsync()
end)
return success and canPrompt
end
local canPrompt = canPromptOptIn()
if canPrompt then
local success, errorMessage = pcall(function()
ExperienceNotificationService:PromptOptIn()
end)
if not success then
warn("Không thể nhắc bật thông báo:", errorMessage)
end
end
-- Lắng nghe sự kiện nhắc bật thông báo đã đóng
ExperienceNotificationService.OptInPromptClosed:Connect(function()
print("Nhắc bật thông báo đã đóng")
end)