Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

The out put is ServerScriptService.DevNameTag:2: attempt to index nil with 'Name' help?

local plr = game.Players.LocalPlayer
local name = plr.Name 
print (name)
if name == "bailley5" or "Elias32418" or "CursedWolf201" or "CrazyCarKids" then
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
			game.ReplicatedStorage.NameTags:WaitForChild("SW Cantina Developer"):Clone().Parent = char.Head
			end)
			end)
			end
			

Help please!

1 answer

✓ Accepted answer

The reason here is you getting localplayer from a local script, you can't do that, and you can't also change that script to local script because local script doesn't run on ServerScriptService So what will you do is:

game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "bailley5" or "Elias32418" or "CursedWolf201" or "CrazyCarKids" then
    player.CharacterAdded:Connect(function(char)
            game.ReplicatedStorage.NameTags:WaitForChild("SW Cantina Developer"):Clone().Parent = char.Head
		end
            end)
	end)
end

2 comments

0

Oh thanks!

0

And theres more efficient ways of doing it for example making a table and looping to it.

This discussion is preserved as it was. New answers, comments, and votes are closed.