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

How do you make BillboardGui only visible locally?

Asked by
nilVector 812 Moderation Voter
10 years ago

I'm trying to make it to where you can see a BillboardGui on top of your team-members only, but I can't get it to work. This is in a LocalScript in Workspace.

wait(1)

local player = game.Players.LocalPlayer

if player.TeamColor == BrickColor.new("Bright red") then
    for _,v in pairs(game.Players:GetPlayers()) do
        if v.TeamColor == BrickColor.new("Bright red") then
            local tag = Instance.new("BillboardGui", v.Character.Head)
            tag .Size = UDim2.new(0, 50, 0, 60)
            tag .StudsOffset = Vector3.new(0, 4, 0)

            local frame = Instance.new("Frame", tag )
            frame .Size = UDim2.new(0, 50, 0, 60)
            frame .BackgroundColor3 = Color3.new(181/255, 0, 0)
            frame .BorderColor3 = Color3.new(181/255, 0, 0)

            local textLabel = Instance.new("TextLabel", frame)
            textLabel.Size = UDim2.new(0, 50, 0, 60)
            textLabel.BackgroundTransparency = 1
            textLabel.Font = "ArialBold"
            textLabel.FontSize = "Size48"
            textLabel.Text = "Friendly"
            textLabel.TextColor3 = Color3.new(1, 1, 1)
        end
    end 
end

2 answers

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

LocalScripts don't work in the Workspace. Put this in StarterGui instead.

If the GUI works, but is not local to that specific player, trying parenting it to Workspace.CurrentCamera.

0
Thanks! It works! I +1'd your Reputation! By the way, if have another problem if you can possibly help me with it. Now, it works, but it shows the BillboardGui even when I'm not on the same team as the player even though I instructed it to not do that. Can you help me? Thanks in advance. nilVector 812 — 10y
Ad
Log in to vote
-6
Answered by 10 years ago
print "I have no idea."

Answer this question