there are a few games that can randomly have this window pop up asking you to favorite the game. if you click on yes it will favorite the game for you. how am i able to do this and is there some kind of free resourse for this? how do i code this?
5 Likes
I haven’t tried this yet but from further searching in the library, I came across to this.
I hope this is what we were looking for:
AvatarEditorService | Documentation - Roblox Creator Hub
1 Like
how do i promot it through code
It seems I was right and this is how I used the API:
-- LocalScript
local AvatarEditorService = game:GetService("AvatarEditorService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
-- when player spawn
LocalPlayer.CharacterAdded:Connect(function(char)
AvatarEditorService:PromptSetFavorite(11648237431, Enum.AvatarItemType.Asset, true)
end)
Result:
10 Likes
It didn’t work, do I like need to make it a local script or normal script, where do I put it? Workspace or other?
Localscript and either StarterGui
, StarterPlayer
, or StarterCharacter
.
but for me I’d put it inside StarterPlayer
1 Like
How can I make to Prompt when player Touch a part ?
1 Like
RemoteEvent method:
-- # ServerScript inside the part
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FavoriteEvent = ReplicatedStorage:FindFirstChild("FavoriteEvent")
local part = script.Parent
local id = 11648237431
--# create RemoteEvent for lazy people.
if not FavoriteEvent then --# check if the remote exists. else create one.
FavoriteEvent = Instance.new("RemoteEvent")
FavoriteEvent.Name = "FavoriteEvent"
FavoriteEvent.Parent = ReplicatedStorage
end
part.Touched:Connect(function(partThatTouched)
local partThatTouchedParent = partThatTouched.Parent --# lets check if its a "model"
--# get the Player if the partThatTouchedParent is a character of a player.
local getPlayer = Players:GetPlayerFromCharacter(partThatTouchedParent )
if getPlayer then --# lets check if its a legit player.
FavoriteEvent:FireClient(getPlayer, id)
end
end)
--# Localscript inside the starterplayer
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FavoriteEvent = ReplicatedStorage:WaitForChild("FavoriteEvent", 10)
local AvatarEditorService = game:GetService("AvatarEditorService")
local LocalPlayer = Players.LocalPlayer
FavoriteEvent.OnClientEvent:Connect(function(id)
AvatarEditorService:PromptSetFavorite(id, Enum.AvatarItemType.Asset, true)
end)
2 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.