How to make a nametag appear command

I need help...

I am trying to script an Military Police game and I’d like an MP to say !clear (username) and it will put a little nametag above their name saying “cleared” in red or something. Does anybody know how to do this?

Thank you.

1 Like

First, we need to get the username of the chatted text, so we’ll use string.split, here’s an example if you’re not too familiar with that method.

local Username = string.split(msg," ") -- keep in mind this will only work if there's one space in between the username and the command!

After that, use workspace:FindFirstChild(Username[2]), this will get us the character of the player, then clone or instance a Billboard Gui to that character.

Thank you!
Do they need to be in the same script?

What do you mean by “same script”?

Do I need to make another script for the findfirstchild?

It depends on what you’re doing on this original script, if the original script handles the chatted event, then no, you do not need another script, otherwise it’s your choice to put it in another script or in the same script.

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