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

What does ManChild266 is not a vaid part of workspace?

Asked by 4 years ago
Edited 4 years ago
local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
    if player.Name == "ManChild266" then
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = game.Workspace[player.Name].Head
        clonedgui.TextLabel.Text = "Founder"
        clonedgui.TextColor3 = Color3.fromRGB(255,255,0)
    end
    if player.Name == "cwood2006" then
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = game.Workspace[player.Name].Head
        clonedgui.TextLabel.Text = "Founder"
        clonedgui.TextColor3 = Color3.fromRGB(255,255,0)
    end 
    if player.Name == "lickface980" then
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = game.Workspace[player.Name].Head
        clonedgui.TextLabel.Text = "Founder"
        clonedgui.TextColor3 = Color3.fromRGB(255,255,0)
    end
        if player.Name == "xXDeathSpectreXx" then
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = game.Workspace[player.Name].Head
        clonedgui.TextLabel.Text = "Founder"
        clonedgui.TextColor3 = Color3.fromRGB(255,255,0)
    end 
        if player.Name == "MomentousSithlord99" then
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = game.Workspace[player.Name].Head
        clonedgui.TextLabel.Text = "Founder"
        clonedgui.TextColor3 = Color3.fromRGB(255,255,0)
    end
end)

0
It says ManChild266 is not a vaid part of workspace ManChild266 2 — 4y

2 answers

Log in to vote
0
Answered by
Pupppy44 671 Moderation Voter
4 years ago

It says that because the player's character hasn't loaded yet. You can use WaitForChild.

clonedgui.Parent = workspace:WaitForChild(player.Name).Head

Hope this helps!

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I noticed a few errors in the code so I shortened it to make it easier for you:

local billboard = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local founders = {"ManChild266","cwood2006","lickface980","xXDeathSpectreXx","MomentousSithlord99"}

game.Players.PlayerAdded:Connect(function(plr)
    for a, newPlr in pairs(founders) do
        if plr.Name == newPlr then
            repeat wait() until plr.Character
            local bg = billboard:Clone()
            bg.Parent = plr.Character.Head
            bg.TextLabel.Text = "Founder"
            bg.TextLabel.TextColor = Color3.fromRGB(255,255,0)
        end
    end
end)

Here were the errors I caught so you have a future reference: When you attempted to change the text color of the label, you accidentally tried to set the text color to the gui itself which isn't a valid property. Additionally, TextColor3 is not a property of a TextLabel, it should only be TextColor without the "3". Finally, the game "attempted to index a nil value" because the find character function didn't work.

0
It didn't all fit the page so remember to paste from "View Source" CreationNation1 459 — 4y
0
Remember to change the title to solved and accept and answer! CreationNation1 459 — 4y

Answer this question