Hey so I'm new to scripting, very new.
I'm trying to make it so the nametag GUI will change depending on individual users. So for default users (as seen below) it will just show their name, but for individuals like myself and Peter_Ashford it will show specialized nametags custom to their role. However this script is having problems as lets say Peter and I were in a game, I would be given his title and he would be given some random citizens title and the random citizen might have my title. If someone could help me figure out as to why this is happening (also it's not giving anyone below peter a title)
game.Players.PlayerAdded:connect(function(Player) script.Parent.RankGui.Holder.PlayersName.Text = Player.Name if Player.Name == "Na_n" then script.Parent.RankGui.Holder.PlayersName.Text = "His Majesty".." "..Player.Name end if Player.Name == "Peter_Ashford" then script.Parent.RankGui.Holder.PlayersName.Text = "His Royal Highness".." "..Player.Name.." ".."KM" end if Player.Name == "Alexander_Ashford" then script.Parent.RankGui.Holder.PlayersName.Text = "His Royal Highness".." "..Player.Name end if Player.Name == "William_Houghton" then script.Parent.RankGui.Holder.PlayersName.Text = "His Royal Highness".." "..Player.Name end if Player.Name == "KeirYandem" then script.Parent.RankGUI.Holder.Playersname.Text = "The Rt. Hon.".." "..Player.Name.." ".."MR" end if Player.Name == "Griggi" then script.Parent.RankGUI.Holder.Playersname.Text = "The Rt. Hon.".." "..Player.Name.." ".."MR" end if Player.Name == "TimothyJWolfe" then script.Parent.RankGUI.Holder.Playersname.Text = "The Rt. Hon. Speaker".." "..Player.Name.." ".."MR" end if Player.Name == "TracticDev" then script.Parent.RankGUI.Holder.Playersname.Text = "The Hon.".." "..Player.Name.." ".."MR" end if Player.Name == "sanderdebouwer" then script.Parent.RankGUI.Holder.Playersname.Text = "The Hon.".." "..Player.Name.." ".."MR" end if Player.Name == "Benjamin_Paisley" then script.Parent.RankGUI.Holder.Playersname.Text = "The Rt. Hon.".." "..Player.Name.." ".."MR" end end)
I suggest just using the players' id's instead of names. Example:
local id = 123456789 if id then script.Parent.RankGUI.Holder.Playersname.Text = "The Rt. Hon." .. Player.Name.. "MR"