Is there any way to prompt a player to favorite the game?

put this avatarEditorService:PromptSetFavorite(–set this to your placeid, Enum.AvatarItemType.Asset, true) in startplayerscripts with a local player scripts

Can you do it with follow or and like ?

no we can’t, maybe in the future

1 Like

This is a way of doing it

local AvatarEditorService = game:GetService("AvatarEditorService")

Game.Players.LocalPlayer.CharacterAdded:Connect(function(char)
	AvatarEditorService:PromptSetFavorite(1234567890, Enum.AvatarItemType.Asset, true)
end)
4 Likes
  1. api access should be enabled
  2. local script
  3. if it’s a one time prompt or a loop on join put it in StarterPlayerScripts, if you make it prompt off of an event it’s pretty much up to you
  4. if theres an error it should be straightforward enough for you to understand
1 Like

Put this in local script in StarterGui, You do not have to edit anything.
if you want to wait sometime before prompting the player, just add wait before the line like this:

wait(5)
game:GetService("AvatarEditorService"):PromptSetFavorite(game.PlaceId, Enum.AvatarItemType.Asset,true)

with no wait:

game:GetService("AvatarEditorService"):PromptSetFavorite(game.PlaceId, Enum.AvatarItemType.Asset,true)

Just make sure these are enabled in case.

image

5 Likes

put it in starter gui thats how it worked for me

As @Fizzitix said, you can use AvatarEditorService.

local AvatarEditorService = game:GetService("AvatarEditorService")
local UNIVERSE_ID = 0000000000

AvatarEditorService :PromptSetFavorite(UNIVERSE_ID , Enum.AvatarItemType.Asset, true)

1 Like

You can use it with Button or Touch

local button = script.Parent

button.MouseButton1Click:Connect(function()
	game:GetService("AvatarEditorService"):PromptSetFavorite(game.PlaceId, Enum.AvatarItemType.Asset,true)
end)
1 Like

While giving a nice award in any victory, you can add an interesting button under the award, and with the following code, you can take precautions against errors such as double-clicking on the button. @SeargeantOfArmy

To add the game to favorites:

local button = script.Parent
local isPromptInProgress = false
local promptCompletedConnection

button.MouseButton1Click:Connect(function()
	if not isPromptInProgress then
		isPromptInProgress = true
		promptCompletedConnection = game:GetService("AvatarEditorService").PromptSetFavoriteCompleted:Connect(function(success)
			isPromptInProgress = false
			promptCompletedConnection:Disconnect()
			if success then
				print("PromptSetFavorite process completed.")
				
			else
				print("PromptSetFavorite process failed.")
				
			end
		end)
		game:GetService("AvatarEditorService"):PromptSetFavorite(game.PlaceId, Enum.AvatarItemType.Asset, true)
	else
		print("PromptSetFavorite process is already in progress.")
	end
end)
5 Likes

You can do it!

local AvatarEditorService = game:GetService("AvatarEditorService")
local UNIVERSE_ID = [UNIVERSE_ID] -- Edit this!

AvatarEditorService :PromptSetFavorite(UNIVERSE_ID , Enum.AvatarItemType.Asset, true)

game:GetService("AvatarEditorService"):PromptSetFavorite(game.PlaceId,1,true)

Do not change game.PlaceId, it will automatically set it. The script must be inside of a local script. Example of how I used this. You must also add a pcall just incase a player spams it, if that occurs. The code will not continue to run anymore.

(sorry, I just noticed that the solution was already posted.)
(link doesn’t work for some reason, sorry)

5 Likes

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