PromptSetFavoriteCompleted Event Error

I am trying to make an avatar editor, and I get the error “PromptSetFavorite can not be called again while currently in progress”

Even though the previous prompt had completed.

	local function promptCatalogItem()
			local view = editorUi.Editor.ItemView.Window
			
			view.ProductName.Text = itemData.Name
			view.ProductImage.Image = "rbxthumb://type=Asset&id="..itemData.Id.."&w=420&h=420"
			if readInventory then
				local curFav = avatarEditor:GetFavorite(itemData.Id, Enum.AvatarItemType.Asset)
				if curFav then
					view.Like.Image = isLiked
				else
					view.Like.Image = isNotLiked
				end
				view.Like.Activated:Connect(function()
					activeSetFavorite = {view.Like, not curFav}
					avatarEditor:PromptSetFavorite(itemData.Id, Enum.AvatarItemType.Asset, not curFav)
				end)
			end
			
			editorUi.Editor.ItemView.Visible = true
		end
editorConnections.SetFavoriteCallback = avatarEditor.PromptSetFavoriteCompleted:Connect(function(result)
		if result == Enum.AvatarPromptResult.Success then
			local newFavBool = activeSetFavorite[2]
			if newFavBool then
				activeSetFavorite[1].Image = isLiked
			else
				activeSetFavorite[1].Image = isNotLiked
			end
			activeSetFavorite = nil
		end
	end)

I presume that I may have to create the callback event EVERY time I prompt the user, which is not said anywhere in the documentation

I found my issue, I appear to have overlooked updating my boolean where I call to prompt the player.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.