Hello!
I've been trying to create a script where it shows a player's name above their head (With a billboard gui) which works. Then, I'm trying add a part where if another player (Call him PL1) is at least 20 studs away from someone else (Call him PL2) then PL1 can not see PL2's gui and PL2 can not see PL1's gui. Output comes up saying, 'HumanoidRootPart is not a valid member of Camera,' help is greatly appreciated. Here is script:
local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if player.Name == player.Name then
local clonedgui = billboardgui:Clone()
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
clonedgui.TextLabel.Text = player.Name
clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
for i,v in pairs(workspace:GetChildren())do
local v1 = v.HumanoidRootPart.CFrame.p --It's either this
local v2 = char.HumanoidRootPart.CFrame.p --Or this
local max = 20
if (v1-v1).magnitude <=max then
clonedgui.Enabled = true
else
clonedgui.Enabled = false
end
end
end
end)
end)
Again, help is greatly appreciated.

2 comments
By the way please accept my answer if worked.
What is the problem? Please tell me