Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to script custom gui for specific team?

In the Explorer tab

ServerScriptService
     Script
         BlueTeam
              Tag (BillboardGui)
        RedTeam
              Tag (BillboardGui)

This is a script in Script .

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(character)
		local humanoid =p:WaitForChild("Humanoid")
		humanoid.HealthDisplayDistance = 0
		humanoid.NameDisplayDistance = 100
		local Folder = script:FindFirstChild(p.Team.Name)
		if Folder then
			local Tags = Folder:FindFirstChild("Tag")
			if Tags then
				for i,v in pairs(Tags:GetChildren()) do
					v:Clone().Parent = p.Head
				end
				end
			end
	end)
end)

The script helps displaying the circle (BillboardGui) on top of the player's head. The circle has 2 colors, red and blue, will be shown depending on the player's team. Somehow, the script does not work. Could anyone solve this?

1 answer

✓ Accepted answer

#Problem

  1. So you are looping trough Tag (Which you said was a BillboardGui). But you only need to Clone the actual BillboardGui into the Head
  2. you said p.Head and the player Object doesn't have a head.

#Solution

  1. Delete the Loop and just Clone it and set it parent to the Players Head
  2. Replace p with character

#Final Script

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(character)
        local humanoid =p:WaitForChild("Humanoid")
        humanoid.HealthDisplayDistance = 0
        humanoid.NameDisplayDistance = 100
        local Folder = script:FindFirstChild(p.Team.Name)
        if Folder then
            local Tags = Folder:FindFirstChild("Tag")
            if Tags then
			Tags:Clone().Parent = character.Head
                end
            end
    end)
end)

4 comments

0

It still doesnt show the billboardgui.

0

hmm

0

Ok. I fixed the folders' name and it worked. But, Tag's position remained at 0,0,0

0

On the final script you posted, on line 4, it should be local humanoid =character:WaitForChild("Humanoid")

This discussion is preserved as it was. New answers, comments, and votes are closed.