WaitForChild is not a valid member of RBXScriptSignal

I am trying to make it so a “LastName” value from the LocalPlayer can be put onto a players nametag from a belt they can equip in-game, this is my current script;

local Players = game:GetService("Players")
local plr = game.Players.PlayerAdded

local namevalue = plr:WaitForChild("LastName")
local giver = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("Giver")

game.Players.PlayerAdded:Connect(function(plr)
	script.Parent.Text = plr:WaitForChild("LastName").Value
end)

giver.Touched:Connect(function(plr)
	script.Parent.Text = plr:WaitForChild("LastName").Value
end)

An error I have received is this; WaitForChild is not a valid member of RBXScriptSignal
Which from research, means I cannot use a “WaitForChild” with a RBXScriptSignal.

What would my solution be for this?

Remove this line, since it conflicts with the other plr variable.

That would make an error for the line local namevalue = plr:WaitForChild("LastName") as it would have no local to go off of for “plr”?

Oh I just realized, I don’t even need that line either do I.

PlayerAdded is a function that is to be fired upon a player joining. This in turn would not work at all, as you are trying to bind a yield (instance) function to a function, which can only be tied to instances.

Read more about PlayerAdded here!

1 Like

oh my god…

anyways, change that to Players.LocalPlayer since Players variable was already set (and wasn’t even used) and PlayerAdded is an event, it wouldn’t return a player like what LocalPlayer does

1 Like

Dont use game.Players.PlayerAdded, local scripts under starterplayerscripts load after the player instance is created, so the event serves no purpose

Use game.Players.LocalPlayer

Also why making a nametag system as a local script?