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

Group rank over head if not in group?

Asked by 7 years ago

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)

01groupid = 3309505 --Change this to your group ID.
02 
03game.Players.PlayerAdded:connect(onPlayerRespawned)--(Do not chang)--
04function onPlayerRespawned(newPlayer)
05    wait(1)
06    if newPlayer:IsInGroup(groupid) then
07        gui=Instance.new("BillboardGui")
08        gui.Parent=newPlayer.Character.Head
09        gui.Adornee=newPlayer.Character.Head
10        gui.Size=UDim2.new(3,0,1.25,0)
11        gui.StudsOffset=Vector3.new(0,3,0)
12        texta=Instance.new("TextBox")
13        texta.Size=UDim2.new(1,0,1,0)
14        texta.BackgroundTransparency = 1
15        texta.TextScaled = true
View all 53 lines...
0
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 lukebloxdaily 6 — 7y
0
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 User#17862 0 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

So instead of doing IsNotInGroup(), which is not a function, you can just add an else statement to your IsInGroup() function. I have edited your code below to show what I mean. You had it all correct, all you needed to do was add an else. I hope this helps.

01groupid = 3309505 --Change this to your group ID.
02 
03function onPlayerRespawned(newPlayer)
04    wait(1)
05    if newPlayer:IsInGroup(groupid) then
06        gui=Instance.new("BillboardGui")
07        gui.Parent=newPlayer.Character.Head
08        gui.Adornee=newPlayer.Character.Head
09        gui.Size=UDim2.new(3,0,1.25,0)
10        gui.StudsOffset=Vector3.new(0,3,0)
11        texta=Instance.new("TextBox")
12        texta.Size=UDim2.new(1,0,1,0)
13        texta.BackgroundTransparency = 1
14        texta.TextScaled = true
15        texta.TextColor3 = Color3.new(255, 255, 255)
View all 53 lines...
0
thanks! sweetlittlegirlohhl -22 — 7y
Ad
Log in to vote
0
Answered by
Aorda 43
7 years ago

You could put the following at the end of the first function.

1if not newPlayer:IsInGroup(groupid) then
2gui:Destroy()
3end
0
but i want it to say above their head "customer" if they aren't in the group sweetlittlegirlohhl -22 — 7y

Answer this question