My previous topic for this was the Actions demo (this will probably just become the PlayerActionsMenu (what I would name it) because that seems like an appropriate choice).
I may or may not release this 'cause it’s kinda buggy, but, at least we have a better-looking one now! The video | This is low quality, sorry (1.8 MB)
and the high quality image:
“Block This Player” will turn into “Change Block Status” because it goes in two ways, blocking and unblocking.
Currently, because of a previous bug, the menu is cloned to the StarterGui so it currently stacks. I will fix this in the future. (As in, it will layer on top of eachother each click and you will have to close the extra layers )
The mouse icon when you hover over a character also is not desired, so I will change that too.
I’m not sure if I can link the game here (rules?) so I will hold off on that until I am told I cannot or I can do so.
P.S. The image intentionally has a “pop” effect, so that’s why it hovers/is scaled over the background.
Also, it doesn’t have the MeshPart pyramid arrow thingy floating over the character yet, and I probably will use Highlights instead (when they are released) to signify the player being selected. This will be the color of that old MeshPart (blue)
This actually looks better than Roblox’s! I am currenlty remaking player list in the same style as I don’t like how the current one looks (and because I can add custom actions like Ban, Kick, etc; might release it after finished)
P. S. You can change “Change Friend Status” to “Send Friend Request” and “Unfriend” by listening to PlayerFriended and PlayerUnfriended events. You can get them by using StarterGui:GetCore() function like this:
local PlayerFriended = StarterGui:GetCore("PlayerFriendedEvent").Event
local PlayerUnfriended = StarterGui:GetCore("PlayerUnfriendedEvent").Event
Same with blocked/unblocked:
local PlayerBlocked = StarterGui:GetCore("PlayerBlockedEvent").Event
local PlayerUnblocked = StarterGui:GetCore("PlayerUnblockedEvent").Event
Oh my gosh thank you so much, now I can change the image label!
I just wanted to modernize the avatarcontextmenu because the old one was like that Legacy lighting option, it didn’t even have the Gotham font.
This is my code for the Blocked/Unblock or whatever.
local BlockedUserIds = game.StarterGui:GetCore("GetBlockedUserIds")
for _, BlockedUserId in ipairs(BlockedUserIds) do
if BlockedUserId == game.Players:FindFirstChild(sp.CurrentFocus.Value).UserId then
game.StarterGui:SetCore("PromptUnblockPlayer", game.Players:FindFirstChild(sp.CurrentFocus.Value))
game.StarterGui.Success:Play()
else
if game.Players:FindFirstChild(sp.CurrentFocus.Value) ~= nil then
game.StarterGui:SetCore("PromptBlockPlayer", game.Players:FindFirstChild(sp.CurrentFocus.Value))
game.StarterGui.Success:Play()
end
end
end
This means I can incorporate it into the script that clones the GUI into the PlayerGui! And I can incorporate it here into the localscript that handles the prompts for block and friending.
Uh- not into the cloner, just the LocalScript. Oops, LOL
Here we are! It constantly checks if CurrentFocus (the player’s username that is selected) is blocked/not blocked, and changes the text accordingly
while true do task.wait()
local BlockedUserIds = game.StarterGui:GetCore("GetBlockedUserIds")
for _, BlockedUserId in ipairs(BlockedUserIds) do
if BlockedUserId == game.Players:FindFirstChild(sp.CurrentFocus.Value).UserId then
sp.Text = " Unblock"
else
if game.Players:FindFirstChild(sp.CurrentFocus.Value) ~= nil then
sp.Text = " Block"
end
end
end
end
The ten spaces at the start of “Block” and “Unblock” are the indents (don’t wanna mess with UIPadding for that (yet))
I’m testing out the game right now with the while true do loops, thank you for helping! I never realized I could listen for events or just use a simple loop.
Why use while loops if you can listen to the events and connect them to a single function that will update the text?
Your script can be simplified to this:
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local PlayerBlocked = StarterGui:GetCore("PlayerBlockedEvent").Event
local PlayerUnblocked = StarterGui:GetCore("PlayerUnblockedEvent").Event
local function UpdateBlockStatus()
local BlockedUserIds = StarterGui:GetCore("GetBlockedUserIds")
local FocusedPlayer = Players:FindFirstChild(sp.CurrentFocus.Value)
if FocusedPlayer and table.find(BlockeduserIds, FocusedPlayer.UserId) then
sp.Text = "Unblock"
else
sp.Text = "Block"
end
end
PlayerBlocked:Connect(UpdateBlockStatus)
PlayerUnblocked:Connect(UpdateBlockStatus)
Same with friended/unfriended events but instead of getting a table with blocked ids check if players are friends. Sometimes CoreScripts load after LocalScripts, so you’ll have to repeat the StarterGui:GetCore() action. I can share a fucntion that does it safely if you want.
Why not just set TextXAlignment to Enum.TextXAlignment.Center in the properties widget?
The first parameter is the blocked/unblocked player.
P.S. I’ll reply tomorrow after I wake up if you’ll have any questions.
Then move the TextLabel from the ImageLabel like this:
And add a UIPadding with PaddingLeft set to some number.
Using spaces to move text is a bad idea.
Hey! Two years later and it was requested that the place file was added (indirectly).
The Rect properties of the background are broken because Roblox has added some things to their icons array. This can probably be fixed if you toy around with it.
I haven’t worked on it for forever, so the things that were mentioned about ‘working on it’ may have not happened since then. AvatarContextMenuModern.rbxl (60.6 KB)