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
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)
- api access should be enabled
- local script
- 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
- if theres an error it should be straightforward enough for you to understand
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.
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)
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)
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)
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)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.