How do I make this Billboard GUI only show up for people in a certain group?

How do I make this Billboard GUI only show up for people in a certain group? This is my code but it doesn’t seem to be working.

local billboard = script.BillboardGui


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if player:IsInGroup(4199740) then
			local newgui = billboard:Clone()
			newgui.Parent = char.Head
			else
		end
	end)
2 Likes

You would also need to set the BillboardGui’s adornee to the character’s head

1 Like

How would I do that, if you don’t mind me asking?

First of all you can’t do

in a local script so you would have to do

local player = game.Players.LocalPlayer
player.CharacterAdded:Connect(function(char)
while true do
if player:IsInGroup(4199740) then
local newgui = billboard:Clone()
newgui.Parent = char.Head
else
end
end
end)

Oh no, this was in a Server Script.

billboard.Parent = char.Head
billboard.Adornee = char.Head
2 Likes

Why use a loop? It’s not like you’re constantly checking when you can just check once.

To OP @KaylaPls, put this SSS

local Billboard = game.ServerStorage:WaitForChild('BillboardGui') -- Place your billboard gui in ServerStorage
local GroupId = 0 -- Group Id

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        if player:IsInGroup(GroupId) then
            local newGui = Billboard:Clone()
            newGui.Parent = Character.Head
            newGui.Adornee = Character.Head
        end
    end)
end)
1 Like