So i made a script that shows the rank of the player in a specified group. The group rank part works but the problem is - everyone who is not in the group doesnt have a rank over their heads. I wanted to make it so the rank said "customer" if they were not in the group. Here is my script (you can scroll down to the not in group part)
groupid = 3309505 --Change this to your group ID.
game.Players.PlayerAdded:connect(onPlayerRespawned)--(Do not chang)--
function onPlayerRespawned(newPlayer)
wait(1)
if newPlayer:IsInGroup(groupid) then
gui=Instance.new("BillboardGui")
gui.Parent=newPlayer.Character.Head
gui.Adornee=newPlayer.Character.Head
gui.Size=UDim2.new(3,0,1.25,0)
gui.StudsOffset=Vector3.new(0,3,0)
texta=Instance.new("TextBox")
texta.Size=UDim2.new(1,0,1,0)
texta.BackgroundTransparency = 1
texta.TextScaled = true
texta.TextColor3 = Color3.new(255, 255, 255)
texta.Text = ("- " .. newPlayer:GetRoleInGroup(groupid) .. " -")
texta.Parent=gui
w = game.Lighting.WepsGroup:GetChildren()
for i = 1,#w do
w[i]:Clone().Parent = newPlayer.Backpack
--this is the part where i tried to script the "customer part"
if newPlayer:IsNotInGroup(groupid) then
gui=Instance.new("BillboardGui")
gui.Parent=newPlayer.Character.Head
gui.Adornee=newPlayer.Character.Head
gui.Size=UDim2.new(3,0,1.25,0)
gui.StudsOffset=Vector3.new(0,3,0)
texta=Instance.new("TextBox")
texta.Size=UDim2.new(1,0,1,0)
texta.BackgroundTransparency = 1
texta.TextScaled = true
texta.TextColor3 = Color3.new(255, 255, 255)
texta.Text = ("Customer")
texta.Parent=gui
w = game.Lighting.WepsGroup:GetChildren()
for i = 1,#w do
w[i]:Clone().Parent = newPlayer.Backpack
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)

2 comments
Im not rlly sure how, but heres a suggestion, maybe try to make it so if they r not in that group another script (that is always disabled untill the player isnt in group) that when it goes abled (disabled = false) the player has customer on their head
An easier way to see if a player respawns is by using the Player.CharacterAdded() function. http://wiki.roblox.com/index.php?title=API:Class/Player/CharacterAdded