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

Why doesn't this work? I think it is done correctly.

Nothing is in the Developer Console.

local tag = game:GetService("ServerStorage"):WaitForChild("NameTag")

local Special_People = {"Enomphia", "skye_a74", "iiJakey_1"}

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		for _,v in pairs(Special_People) do
		if plr.Name == v then
		local clonedtag = tag:Clone()
		clonedtag.n.Text = (plr.Name)
		clonedtag.Parent = char.Head
		clonedtag.n.TextColor3 = Color3.new(0,0,0)
		else
		local clonedtag = tag:Clone()
		clonedtag.n.Text = (plr.Name)
		clonedtag.Parent = char.Head
		end
		end
	end)
end)

10 comments

0

Your question is too broad. What does the script do? What is the expected behaviour?

0

If nothing is in the output, it's probably something to do with your conditional statements "If, else". Perhaps check which one happens by using a print

0

@incapaz It gives a Player a Billboard Gui into their head when they join. But if they are in the table "Special_People" it gives them a name tag that is Black.

0

If it's giving the tag to all players, then Ik the reason. But pls elaborate first.

0

@Enomphia, yes but what is the problem?

0

The people that are in the Table 'Special people' get a tag. And it makes there tag 'Black' - Color3.new(0,0,0). But It is not doing it. And I want to know why it Doesn't I even added a print(plr.Name) after if plr.Name ==v then. And it printed my Username "Enomphia" so it should work. But it's not changing the color

0

Answered.

0

K if its redirecting to line 8, which is else, ur errors in the if statement. Gimme a sec

0

Try it with just YOUR name.

0

@Enomphia I actually just found the problem for sure. Look at my answer.

2 answers

✓ Accepted answer

Boom! Just found the issue. I copied your script and used it myself and It worked, with one person in the Table. Try doing this:

local tag = game:GetService("ServerStorage"):WaitForChild("NameTag")
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
			if player.Name == "Enomphia" then
				local clonedtag = tag:Clone()
				clonedtag.n.Text = (player.Name)
				clonedtag.Parent = game.Workspace:WaitForChild(player.Name).Head
				clonedtag.n.TextColor3 = Color3.fromRGB(0,0,0)
			elseif
				player.Name == "skye_a74" then
				local clonedtag = tag:Clone()
				clonedtag.n.Text = (player.Name)
				clonedtag.Parent = game.Workspace:WaitForChild(player.Name).Head
				clonedtag.n.TextColor3 = Color3.fromRGB(0,0,0)
			elseif
				player.Name == "iiJakey_1" then
				local clonedtag = tag:Clone()
				clonedtag.n.Text = (player.Name)
				clonedtag.Parent = game.Workspace:WaitForChild(player.Name).Head
				clonedtag.n.TextColor3 = Color3.fromRGB(0,0,0)
			else
				local clonedtag = tag:Clone()
				clonedtag.n.Text = (player.Name)
				clonedtag.Parent = game.Workspace:WaitForChild(player.Name).Head
			end
end)

1 comment

0

No don't find the character in workspace. That will error if a player named Part joins the game LOL

maybe try to do it on the client side? something like this works for me:

local player = game.Players.LocalPlayer 
local char = player.Character
if not char or char.Parent then
	char = player.CharacterAdded:Wait()
end
if player.Name == "Warmthness" or "you" then
	game.ServerStorage.NameTag:Clone().Parent = char:FindFirstChild("Head")
end

1 comment

0

or is used for Boolean values

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