My addition to a script from the internet does not work:
It is for name tags
game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
plr:WaitForChild("Humanoid").DisplayDistanceType = "None"
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = true
local clone = game.ReplicatedStorage.NameTags:WaitForChild("Name"):Clone()
clone.Parent = plr.Head
clone.Adornee = plr.Head
clone.PlayerToHideFrom = name
-- the line above gives an error ^
clone:WaitForChild("TextLabel").Text = name
end
end)
local repstorage = game:GetService("ReplicatedStorage")
game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
plr:WaitForChild("Humanoid").DisplayDistanceType = "None"
if playerinplayers then
playerinplayers.CanLoadCharacterAppearance = true
local nametagclone = repstorage:WaitForChild("NameTags"):WaitForChild("Name"):Clone()
nametagclone.Parent = plr.Head
nametagclone.Adornee = plr.Head
nametagclone.PlayerToHideFrom = playerinplayers
nametagclone:WaitForChild("TextLabel").Text = name
end
end)