I’ve been trying to make custom nametags for my game, and they work. However, I tried making a custom command that changes the text and color of the nametag and it worked, but it changed the tag of the whole server, and I want to only affect the player who typed the command, and do note I want it to appear to the rest of the server, not just the player.
Here’s the script:
command = "!sshow"
command2 = "!shide"
local sshow = false
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name)
msg = string.lower(msg)
if (msg == command) and sshow == false then
sshow = true
print("TagShown")
end
if (msg == command2) and sshow == true then
sshow = false
print("TagHidden")
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
local rep = game:GetService("ReplicatedStorage")
local nametag = rep.NameTag
--Functions
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
--Varibles
local head = char.Head
local newtext = nametag:Clone()
local uppertext = newtext.UpperText
local lowertext = newtext.LowerText
local image = newtext.RankImage
local humanoid = char.Humanoid
humanoid.DisplayDistanceType = "None"
--Main Text
newtext.Parent = head
newtext.Adornee = head
uppertext.Text = player.Name
while true do
wait(.1)
if sshow == true and player.Name == "DDZ_76" then
image.Visible = true
image.Image = "rbxassetid://7453101593"
lowertext.Text = "Owner"
lowertext.TextColor3 = Color3.fromRGB(255, 204, 0)
uppertext.TextColor3 = Color3.fromRGB(30, 30, 30)
end
if sshow == false and player.Name == "DDZ_76" then
wait(1.8)
image.Visible = false
uppertext.TextColor3 = Color3.fromRGB(255, 255, 255)
lowertext.Text = player.Team.Name
lowertext.TextColor3 = player.Team.TeamColor.Color
end
end
end)
end)