Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

Nothing is in the Developer Console.

01local tag = game:GetService("ServerStorage"):WaitForChild("NameTag")
02 
03local Special_People = {"Enomphia", "skye_a74", "iiJakey_1"}
04 
05game.Players.PlayerAdded:Connect(function(plr)
06    plr.CharacterAdded:Connect(function(char)
07        for _,v in pairs(Special_People) do
08        if plr.Name == v then
09        local clonedtag = tag:Clone()
10        clonedtag.n.Text = (plr.Name)
11        clonedtag.Parent = char.Head
12        clonedtag.n.TextColor3 = Color3.new(0,0,0)
13        else
14        local clonedtag = tag:Clone()
15        clonedtag.n.Text = (plr.Name)
16        clonedtag.Parent = char.Head
17        end
18        end
19    end)
20end)
0
Your question is too broad. What does the script do? What is the expected behaviour? User#19524 175 — 6y
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 ininja966 20 — 6y
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. Enomphia 39 — 6y
0
If it's giving the tag to all players, then Ik the reason. But pls elaborate first. SBlankthorn 329 — 6y
View all comments (6 more)
0
@Enomphia, yes but what is the problem? SBlankthorn 329 — 6y
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 Enomphia 39 — 6y
0
Answered. SBlankthorn 329 — 6y
0
K if its redirecting to line 8, which is else, ur errors in the if statement. Gimme a sec SBlankthorn 329 — 6y
0
Try it with just YOUR name. SBlankthorn 329 — 6y
0
@Enomphia I actually just found the problem for sure. Look at my answer. SBlankthorn 329 — 6y

2 answers

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

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:

01local tag = game:GetService("ServerStorage"):WaitForChild("NameTag")
02game.Players.PlayerAdded:Connect(function(player)
03    player.CharacterAdded:Connect(function(char)
04            if player.Name == "Enomphia" then
05                local clonedtag = tag:Clone()
06                clonedtag.n.Text = (player.Name)
07                clonedtag.Parent = game.Workspace:WaitForChild(player.Name).Head
08                clonedtag.n.TextColor3 = Color3.fromRGB(0,0,0)
09            elseif
10                player.Name == "skye_a74" then
11                local clonedtag = tag:Clone()
12                clonedtag.n.Text = (player.Name)
13                clonedtag.Parent = game.Workspace:WaitForChild(player.Name).Head
14                clonedtag.n.TextColor3 = Color3.fromRGB(0,0,0)
15            elseif
View all 26 lines...
0
No don't find the character in workspace. That will error if a player named Part joins the game LOL User#19524 175 — 6y
Ad
Log in to vote
0
Answered by
0msh 333 Moderation Voter
6 years ago
Edited 6 years ago

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

1local player = game.Players.LocalPlayer
2local char = player.Character
3if not char or char.Parent then
4    char = player.CharacterAdded:Wait()
5end
6if player.Name == "Warmthness" or "you" then
7    game.ServerStorage.NameTag:Clone().Parent = char:FindFirstChild("Head")
8end
0
or is used for Boolean values SBlankthorn 329 — 6y

Answer this question