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

How to script custom gui for specific team?

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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)
0
It still doesnt show the billboardgui. Nozo_rapsocooz 16 — 4y
0
hmm Luka_Gaming07 534 — 4y
0
Ok. I fixed the folders' name and it worked. But, Tag's position remained at 0,0,0 Nozo_rapsocooz 16 — 4y
0
On the final script you posted, on line 4, it should be local humanoid =character:WaitForChild("Humanoid") Nozo_rapsocooz 16 — 4y
Ad

Answer this question