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

How to fix the non-stop cloning of the Billboard gui?

Asked by 8 years ago
Players = game:GetService("Players")
bbg = game.ReplicatedStorage.bbg -- Replace with correct path, of course


function OnPlayerAdded(plr)
    plr.CharacterAdded:connect(function(character)
            repeat wait() until plr.Character and plr.Character.HumanoidRootPart
    local Head = plr.Character.Head
wait()
    local bb = bbg:Clone()
    local bbt = bb.TextLabel

    bb.StudsOffset = Vector3.new(0,2,0)

    bbt.BackgroundTransparency = 1
    bbt.Position = UDim2.new(0,0,.5,0)
    bbt.Font = "Legacy"
    bbt.FontSize = "Size18"
    bbt.TextWrapped = true  
    bbt.TextColor3 = Color3.new(math.random(1,255)/255,math.random(1,255)/255,math.random(1,255)/255)   
wait()
    bbt.Text = plr.Name
    bb.Parent = Head
end

)
for _,v in pairs(Players:GetPlayers()) do
    wait()
OnPlayerAdded(v)
end

    end

game.Players.PlayerAdded:connect(OnPlayerAdded)




It non-stop clones the billboard gui into the user's head, and that causes lag, any help on making it only clone 1 time each time the user respawns ?

Answer this question