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.

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)
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:

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)
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:

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
0
or is used for Boolean values SBlankthorn 329 — 6y

Answer this question