Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How may I fix my nametag GUI as the customization isn't being applied to the right user?

Asked by
Na_n 0
6 years ago

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)

1 answer

Log in to vote
0
Answered by 6 years ago

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"
0
I'll try that! Na_n 0 — 6y
0
Update: https://gyazo.com/e60c90703e02c221f4f4451d39a555ee This keeps happening! As you can see I am not Peter_Ashford but for some reason I have his title! Na_n 0 — 6y
0
I think I may know your issue. Don't use id as the same variable. Make it id2, id3, etc. Conquesias 85 — 6y
Ad

Answer this question