Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a overhead GUI say a team name?

I want one of my textlabels on my NametagGUI to say the name of the team someoens in? My script so far:

wait()

local Character = script.Parent
local NameTag = script:FindFirstChild("NameTag")


local GroupID = 4313927

local NameTagClone = NameTag:Clone()
NameTagClone.Parent = Character:FindFirstChild("Head")
NameTagClone.Adornee = Character:FindFirstChild("Head")
NameTagClone.Frame.Username.Text = Character.Name
NameTagClone.Frame.GroupRank.Text = game.Players:GetPlayerFromCharacter(Character):GetRoleInGroup(GroupID)

Hope this script helps

3 comments

0

Dont Ya Need To Make Gui First? Then You Can Insert Da Name?

0

so you want the overhead gui to say the Player's team's name?

0

Yes

1 answer

Player:GetRoleInGroup(id) returns a string. You have to put that in a var. Player:IsInGroup(id) returns a bool value (true or false

Ex.

Role = "Owner"
InGroup = true

Code:

local function ChooseRoleColor(BillboardGui)
	local Role = BillboardGui.GroupRole

	if Role.Text == "Owner" then
		Role.TextColor3 = Brickcolor.new("Really blue")
	elseif Role.Text = "Moderator" then
		Role.TextColor3 = Brickcolor.new("Really red")
	end
end)

game.Players.PlayedAdded:Connect(function(player)
	local InGroup = Player:IsInGroup(id)
	
	if InGroup then
		local role = Player:GetRoleInGroup(id)
		local NameDisplayClone = game.ServerStorage.NameDisplay:Clone()
		NameDisplayClone.GroupRole.Text = role
		NameDisplayClone.Parent = player.Character.Head

		ChooseRoleColor(NameDisplayClone)
	end
end)

Whats happening in the code: When the player joins it checks to see if he/she is in the group. If that's true, then it creates a clone of a billboard gui I made, and changes the text to the rank/role of the player. It then set's the parent to the head. After that a function runs to determine what color the text will be based the role.

This discussion is preserved as it was. New answers, comments, and votes are closed.