Incorrect source code on the Documentation page

I copied some source code into Roblox Studio and it is incorrect. Simple mistake by the person writing this code. I went ahead and fixed it. If there is another way to report this, please don’t blast me with hate like everyone else and tell me what to do. Thanks

Code on the page:

local ExperienceNotificationService = game:GetService("ExperienceNotificationService")

-- Function to check whether the player can be prompted to enable notifications
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
end

-- Listen to opt-in prompt closed event 
ExperienceNotificationService.OptInPromptClosed:Connect(function()
	print("Opt-in prompt closed")
end)

What it should be:

local ExperienceNotificationService = game:GetService("ExperienceNotificationService")

-- Function to check whether the player can be prompted to enable notifications
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)
end

-- Listen to opt-in prompt closed event 
ExperienceNotificationService.OptInPromptClosed:Connect(function()
	print("Opt-in prompt closed")
end)
1 Like

This is just an acknowledgment announcement!

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!

2 Likes

Hello @DonaldDuck5150 , thank you for reaching out! You’re right about this mistake, and it has now been fixed. Much appreciated, thank you!

In the future, you can click the pencil icon at the top of the page to directly edit most pages on the site, and it’ll send your revisions to a staff member for review. Otherwise, feel free to make bug reports just like this one and we’ll respond as soon as we’re able :slight_smile:

1 Like