Not sure how to add 2 names to make both have same script.
Cant find solution.
local rep = game:GetService("ReplicatedStorage")
local nametag = rep.NameTag
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local head = char.Head
local newtext = nametag:Clone()
local uppertext = newtext.UpperText
local lowertext = newtext.LowerText
newtext.Parent = head
newtext.Adornee = head
uppertext.Text = player.Name
if player.Name == "Neon_Void" then
lowertext.Text = "Co-Owner"
lowertext.TextColor3 = Color3.fromRGB(255, 0, 4)
end
end)
end)
Using a simple table and function, you can add as many people as you want to the co-owner list:
local rep = game:GetService("ReplicatedStorage")
local nametag = rep.NameTag
local owners = {"Neon_Void", "Another_Person"} -- Create a table of users, not unlike an admin script
function isOwner(player) -- A simple function to check if the player is an owners
for i, v in pairs(owners) do -- This is a common loop that will iterate through the table "owners"
if v == player.Name then -- Check if the value is the same as the players name
return true -- If it is, return the value true
end
end
return false -- If the previous loop doesn't find the player in owners, return false
end
-- Now we can use this function as a verification step
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local head = char.Head
local newtext = nametag:Clone()
local uppertext = newtext.UpperText
local lowertext = newtext.LowerText
newtext.Parent = head
newtext.Adornee = head
uppertext.Text = player.Name
if isOwner(player) then -- If the function finds the player in the owners list, it'll return true
lowertext.Text = "Co-Owner"
lowertext.TextColor3 = Color3.fromRGB(255, 0, 4)
end
end)
end)
The for loop coupled with in pairs is a super common loop you’ll find useful going forward; its used to loop through any table of items, and each time return its position in the table, and the value of the item in the table.
Instead of looping, you could just do table.find(owners, player.Name). As well, I would recommend using UserIds instead of usernames as usernames can be changed.