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

Overhead GUI only working with 1 person, not multiple. Help?

Hello,

In my game, I'm working on overhead GUI's for people's usernames and ranks. For the script, the original "Owner" tag works on my main account, but for the "Owner's Alt", it refuses to work. Could I get some help?

Here is the script:

local rep = game:GetService("ReplicatedStorage")
local nametag = rep.NameTag 

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		--Varibles
		local head = char.Head
		local newtext = nametag:Clone()
		local uppertext = newtext.UpperText
		local lowertext = newtext.LowerText
		local humanoid = char.Humanoid
		
		humanoid.DisplayDistanceType = "None"
		
		--Main Text
		newtext.Parent = head
		newtext.Adornee = head
		uppertext.Text = player.Name
		
		if player.Name == "kolisgrave" then
			lowertext.Text = "Owner"
			lowertext.TextColor3 = Color3.fromRGB(173, 0, 2)
		end

		if player.Name == "prxkvv" then
			lowertext.Text = "Owner's Alt"
			lowertext.TextColor3 = Color3.fromRGB(11, 96, 255)
		end
	end)
end)

5 comments

0

It works for my account "kolisgrave", but for the "prxkvv" account, it doesn't give me the overhead gui.

0

Try using player.UserId instead of player.Name

0

Please commit your script so it updates for everyone in the teamcreate team

0

It works, no need to change

0

You didn't save for prxkvv's user so theres no changes for him

1 answer

Move the second if statement into the first if statement but change the if to elseif - it should look like this:

local rep = game:GetService("ReplicatedStorage")
local nametag = rep.NameTag 

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        --Varibles
        local head = char.Head
        local newtext = nametag:Clone()
        local uppertext = newtext.UpperText
        local lowertext = newtext.LowerText
        local humanoid = char.Humanoid

        humanoid.DisplayDistanceType = "None"

        --Main Text
        newtext.Parent = head
        newtext.Adornee = head
        uppertext.Text = player.Name

        if player.Name == "kolisgrave" then
            lowertext.Text = "Owner"
            lowertext.TextColor3 = Color3.fromRGB(173, 0, 2)
        elseif player.Name == "prxkvv" then
            lowertext.Text = "Owner's Alt"
            lowertext.TextColor3 = Color3.fromRGB(11, 96, 255)
        end
    end)
end)

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