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

How do I make/fix this to where the MaxDistance is visible?

Asked by 5 years ago

I've been making an game/fort thingy on an alt and I wanted to make it have the teammates' name visible even through blocks. I've done research and found that I needed to add the MaxDistance in the script. I've added it but it's still not working. How could I fix it?

local NewP = game.Players.LocalPlayer


function spn(NewP)



wait()
local mesh = NewP.Character.Head:findFirstChild("Mesh")
Part = Instance.new("Part") 
Part.Name = "Fake" 
mesh:Clone().Parent = Part 
w = Instance.new("Weld") 
w.Parent = NewP.Character.Head
w.Part0 = w.Parent 
w.Part1 = Part 
Part.FormFactor = 0 
Part.Size = Vector3.new(2,1,1) 
Part.Parent = NewP.Character 
Part.BrickColor = NewP.Character:findFirstChild("Head").BrickColor
NewP.Character.Head.Transparency = 1
mesh:Clone().Parent = NewP.Character.Head

local players = game.Players:GetChildren()

for i = 1, #players do

    if players[i].TeamColor == NewP.TeamColor then

        if players[i].Character:findFirstChild("Head") and players[i] ~= NewP then

            local big = Instance.new("BillboardGui",NewP.PlayerGui)
            big.MaxDistance = 100000000
            big.Adornee = players[i].Character:findFirstChild("Head")
            big.Size = UDim2.new( 1.0, 0, 1.0, 0 )
            big.StudsOffset = Vector3.new( 0, 2, 0 )


            local name = Instance.new("TextLabel",big)
            name.Position = UDim2.new( 0.5, 0, 0, 0 )
            name.FontSize = 3
            name.Font = 2
            name.BackgroundTransparency = 1
            name.TextStrokeTransparency = 0
            name.Size = UDim2.new(0, 25, 0, 25 )
            name.Text = players[i].Name
            name.TextColor3 = Color3.new(255, 255, 255)

        end

        if NewP.Character:findFirstChild("Head") then

            local g = Instance.new("BillboardGui",players[i].PlayerGui)
            g.MaxDistance = 100000000
            g.Adornee = NewP.Character:findFirstChild("Head")
            g.Size = UDim2.new( 1.0, 0, 1.0, 0 )
            g.StudsOffset = Vector3.new( 0, 2, 0 )


            local ame = Instance.new("TextLabel",g)
            ame.Position = UDim2.new( 0.5, 0, 0, 0 )
            ame.FontSize = 3
            ame.Font = 2
            ame.BackgroundTransparency = 1
            ame.TextStrokeTransparency = 0
            ame.Size = UDim2.new(0, 25, 0, 25 )
            ame.Text = NewP.Name
            ame.TextColor3 = Color3.new(255, 255, 255)

        end

    else

    end


end
end


function A(new) 

new.Changed:connect(function(N) if N == "Character" then spn(new) end end) 

end 

game.Players.ChildAdded:connect(A) 
0
I think you may need for the parent of the billboard gui to be the head sheepposu 561 — 5y

1 answer

Log in to vote
0
Answered by
Psudar 882 Moderation Voter
5 years ago
Edited 5 years ago

To make a billboard Gui Visible through parts, you simply need to change the property AlwaysOnTop to true.

BillboardGuis

Example: lua local NewGui = Instance.new("BillboardGui") NewGui.AlwaysOnTop = true Also, I noticed you were parenting things with Instance.new(), but still changing properties of the object. Just a fair warning, thats a deprecated feature. It causes data loss.

Here's why.

0
Oh, and you should parent it after you've added all the properties. Psudar 882 — 5y
Ad

Answer this question