Make your games more unique - Avatar Context Menu

Hey Devs! Today I’ll show you Avatar Context Menu. This is a very good and unique option that you can add to your game. It could be good for a hangout game or even a simulator, tycoon, obby etc. This feature is very forgotten and it was released in 2018 so that’s why it is very unique and also very easy to implement. Don’t worry it is still updated. This is the first post about this feature THIS YEAR lol.

What is the Avatar Context Menu?

Avatar Context Menu is a menu with different options. When you click on a player, a menu appears.


(The image of the player is not showing in Studio).

This menu contains a few options like chatting with the player, waving to them, viewing or sending a friend request to them. You can also change the selected player. The menu is fully customizable, so you can add your own options or change the colors and sizes, etc. If you’re making a simulator, you could add the option to trade, or in RPG’s you could add a “Stats” option which would show the player’s stats.

How to add it?

Avatar Context Menu can be turned on by making a Localscript in StarterPlayerScripts.

Script:

local StarterGui = game:GetService("StarterGui")
StarterGui:SetCore("AvatarContextMenuEnabled", true)

and that’s it.

Customizing the menu

That’s my favorite part! Because the menu is fully customizable, you can remove all the default options and make your own!
For starters, I will remove the “Wave” option.

Because it’s a default action, we need to remove it by using AvatarContextMenuOption enum! When you’re making your own options you remove them in a different way.

Script:
StarterGui:SetCore("RemoveAvatarContextMenuOption", Enum.AvatarContextMenuOption.Emote)

And we got it!

Now I will be making a simple print script that will send a notification that a print was successful.

 -- Referecing
 local StarterGui = game:GetService("StarterGui")
 local Players = game:GetService("Players")
 local player = Players.LocalPlayer
 -- Creating a BindableEvent and actions after we click the button.
 local bindableEvent = Instance.new("BindableEvent")
 local function onCustomACMAction(targetPlayer)
 StarterGui:SetCore("SendNotification", {
 Title = "ACM Notification!";
 Text = "You successfully printed something."
 })
 print("Player " .. player.Name .. " printed something from " .. targetPlayer.Name .. " in AvatarContextMenu")
 print("Something.")
 end
 bindableEvent.Event:Connect(onCustomACMAction)
 local options = {"Print something!", bindableEvent} -- We can set here the name of our button.
 StarterGui:SetCore("AddAvatarContextMenuOption", options)

Everything here is done locally! You need to make events if you want something to happen on the server.

And after we click the button we get our two prints in the console and the notification.

More Customization

I will customize the menu more so it looks better and more unique!
If you want more customization options check out the DevHub Article.

Script:

StarterGui:SetCore("AvatarContextMenuTheme", { 
	BackgroundTransparency = 0, 
	BackgroundColor = Color3.fromRGB(19, 255, 15),
	NameTagColor = Color3.fromRGB(255, 0, 4),
	NameUnderlineColor = Color3.fromRGB(213, 233, 255),
	ButtonFrameColor = Color3.fromRGB(255, 119, 8), 
	ButtonFrameTransparency = 0.7, 
	ButtonUnderlineColor = Color3.fromRGB(213, 233, 255), 
	Font = Enum.Font.SourceSansBold
})

It looks terrible now…

Links:
Avatar Context Menu Article

Thanks!

31 Likes

Thanks for posting this, it will be a good feature to have in a game of mine. I am surprised that I have never heard of it before, it seems like it would be very popular.

4 Likes

Wow, I am thinking of using this. However, is there a way I can apply a background (medieval type of thing) there?

For anyone with questions, please just take a quick second to look at the documentation page of it.

@alexfinger21, there is a property in there called " BackgroundImage", in which you can change the background (scroll down and you’ll see it)

2 Likes

I needed to edit the post because I forgot to add 1 script.

Hey everyone! If you want you can check out my all Make your games more unique tutorials. I also would recommend bookmarking it, so you could have it for later! Hope you have a nice day!

1 Like

Do you know if that notification works with Xbox players? (since they don’t have chat)

It would be cool to have a couple of canned messages you could send to pop up on their screen.

I don’t know if you can Chat with them, but you can add your own options and configure them. I know it also works with Xbox.