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

What should i do with "Infinite yield possible on" warn ?

Asked by 3 years ago

i try to make a code that the nametag does not stack up when it showed but i got this warn 23:26:33.059 - Infinite yield possible on 'Workspace.BlackBooks.Head:WaitForChild("BillboardGui1")' 23:26:33.060 - Stack Begin 23:26:33.062 - Script 'ServerScriptService.NameTag', Line 22 23:26:33.063 - Stack End

what should i do

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local billboards = game:GetService("ServerStorage"):WaitForChild("Billboards")
local billboardgui1 = game:GetService("ServerStorage"):WaitForChild("BillboardGui1")
local billboardgui2 = game:GetService("ServerStorage"):WaitForChild("BillboardGui2")

game.Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)

        if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,10995771) then
        local clonegui = billboardgui:Clone()
        clonegui.TextLabel.Text = "[VIP] Member"
        clonegui.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
            clonegui.Parent = game.Workspace:WaitForChild(player.Name).Head
        end

        if player.Name == "BlackBooks" then
        local clonegui = billboardgui:Clone()
        clonegui.TextLabel.Text = "[Game Owner]"
        clonegui.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
            clonegui.Parent = game.Workspace:WaitForChild(player.Name).Head
            local text = character.Head:WaitForChild("BillboardGui1") and character.Head:WaitForChild("BillboardGui2")
            text.Enabled = false
        end

        if player.Name == "SleepInBlack" then
                local clonegui = billboardgui:Clone()
        clonegui.TextLabel.Text = "[Owner's Partner]"
        clonegui.TextLabel.TextColor3 = Color3.fromRGB(255, 94, 94)
            clonegui.Parent = game.Workspace:WaitForChild(player.Name).Head

        end

        local cloneguis = billboards:Clone()
        cloneguis.TextLabel.Text = player.Name
        cloneguis.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    cloneguis.Parent = game.Workspace:WaitForChild(player.Name).Head

        local clonegui = billboardgui1:Clone()
        clonegui.TextLabel.Text = "Pemula"
        clonegui.TextLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
        clonegui.Parent = game.Workspace:WaitForChild(player.Name).Head


        if player.leaderstats.Kepintaran.Value >= 1 then
                local clonegui = billboardgui2:Clone()
                clonegui.TextLabel.Text = "Pelajar Baru"
                clonegui.TextLabel.TextColor3 = Color3.fromRGB(204, 142, 105)
                clonegui.Parent = game.Workspace:WaitForChild(player.Name).Head
                player.leaderstats.Rank.Value = "PelajarBaru"

        end
    end)

end)
--10995771
0
its because BillboardGui1 doesnt exist raid6n 2196 — 3y

Answer this question