In my game, there are titles for players. Titles consist as follows in order of precedence:
-
Game Owner
-
Overseer
-
VIP
-
Donor
The Game Owner title is for me, and Overseer is for my community manager. The VIP and Donor titles are both gamepasses. If the player owns the VIP gamepass and the Donor gamepass, the VIP title takes precedence.
By the way, these are located in: StarterPlayer>StarterCharacterScripts>Nametag (script)>BillboardGui>GamepassOwner (TextLabel), Regular (TextLabel), Username (TextLabel)
The problem I’m facing is the implementation of the “Regular” title. I want you to know I made this entire script using ChatGPT 3 and have no scripting knowledge whatsoever. I usually manage to reword what I say and have it eventually spit out something that functions properly–or that I’m at least competent enough to tweak it to work–but for this I’m struggling.
Basically, I want a player to get the “Regular” title if they’re in the group (ID 32857623) and ranked 25. However, if that same person also owns one of the gamepass titles, the gamepass title takes precedence. Normally, the gamepass titles always take precedence. I’ve tried using what ChatGPT gives me but it ends up giving multiple titles at the same time or switching them up. For example, someone in my group at rank 25 was testing for me and ended up receiving the Donor title. I tried to tweak the script again, and this time I had both Game Creator and Regular as a title.
I literally just want the Regular title to be there for people ranked 25 in the group and make it so if they also own one of the gamepass titles, then that gamepass title is priority over the Regular title.
Here is the script that isn’t working properly. I’m sure it’s a really simple fix for someone experienced enough.
wait()
local Char = script.Parent
local nametag = script:FindFirstChild("BillboardGui")
local gamepassOwnerId_Donor = 227839933 -- Donor Gamepass ID
local gamepassOwnerId_VIP = 227840061 -- VIP Gamepass ID
local ownerProfileId = 57639897 -- Profile ID of the special owner player
local priceUserId = 72160286 -- User ID of the "price" player
local groupId = 32857623 -- Group ID
local regularRank = 25 -- The rank that grants the "Regular" title
local Nametagclone = nametag:Clone()
Nametagclone.Parent = Char:FindFirstChild("Head")
Nametagclone.Adornee = Char:FindFirstAncestor("Head")
Nametagclone.Username.Text = Char.Name
local player = game.Players:GetPlayerFromCharacter(Char)
if player then
if player.UserId == ownerProfileId then
Nametagclone.GamepassOwner.Text = "Game Creator"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(0, 0, 0) -- Black color
Nametagclone.Username.TextColor3 = Color3.fromRGB(255, 227, 12)
Nametagclone.Username.TextStrokeColor3 = Color3.fromRGB(180, 141, 25)
elseif player.UserId == priceUserId then
Nametagclone.GamepassOwner.Text = "Manager"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(0, 0, 0) -- Dark gray color
Nametagclone.Username.TextColor3 = Color3.fromRGB(255, 227, 12)
Nametagclone.Username.TextStrokeColor3 = Color3.fromRGB(180, 141, 25)
else
local ownsGamepass_VIP = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassOwnerId_VIP)
local ownsGamepass_Donor = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassOwnerId_Donor)
local groupInfo = game:GetService("GroupService"):GetGroupInfoAsync(groupId)
if groupInfo and groupInfo.IsMember then
local rank = groupInfo.Rank
if rank == regularRank then
Nametagclone.Regular = Instance.new("TextLabel")
Nametagclone.Regular.Name = "Regular"
Nametagclone.Regular.Text = "Regular"
Nametagclone.Regular.TextColor3 = Color3.new(0, 0, 200) -- Blue color
Nametagclone.Regular.Parent = Nametagclone
end
end
if ownsGamepass_VIP then
Nametagclone.GamepassOwner.Text = "VIP"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(255, 227, 12) -- VIP color
elseif ownsGamepass_Donor then
Nametagclone.GamepassOwner.Text = "Donor"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(12, 245, 59) -- Donor color
else
Nametagclone.GamepassOwner.Visible = false
end
end
end
If it helps, this is the script without the Regular title that was working fine before:
wait()
local Char = script.Parent
local nametag = script:FindFirstChild("BillboardGui")
local gamepassOwnerId_Donor = 227839933 -- Donor Gamepass ID
local gamepassOwnerId_VIP = 227840061 -- VIP Gamepass ID
local ownerProfileId = 57639897 -- Profile ID of the special owner player
local priceUserId = 72160286 -- User ID of the "price" player
local Nametagclone = nametag:Clone()
Nametagclone.Parent = Char:FindFirstChild("Head")
Nametagclone.Adornee = Char:FindFirstAncestor("Head")
Nametagclone.Username.Text = Char.Name
local player = game.Players:GetPlayerFromCharacter(Char)
if player then
if player.UserId == ownerProfileId then
Nametagclone.GamepassOwner.Text = "Game Creator"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(0, 0, 0) -- Black color
Nametagclone.Username.TextColor3 = Color3.fromRGB(255, 227, 12)
Nametagclone.Username.TextStrokeColor3 = Color3.fromRGB(180, 141, 25)
elseif player.UserId == priceUserId then
Nametagclone.GamepassOwner.Text = "Overseer"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(0, 0, 0) -- Dark gray color
Nametagclone.Username.TextColor3 = Color3.fromRGB(255, 227, 12)
Nametagclone.Username.TextStrokeColor3 = Color3.fromRGB(180, 141, 25)
else
local ownsGamepass_VIP = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassOwnerId_VIP)
local ownsGamepass_Donor = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassOwnerId_Donor)
if ownsGamepass_VIP then
Nametagclone.GamepassOwner.Text = "VIP"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(255, 227, 12) -- VIP color
elseif ownsGamepass_Donor then
Nametagclone.GamepassOwner.Text = "Donor"
Nametagclone.GamepassOwner.TextColor3 = Color3.fromRGB(12, 245, 59) -- Donor color
else
Nametagclone.GamepassOwner.Visible = false
end
end
end