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

infinite yield on something that exists?

Asked by 4 years ago

05:01:18.679 - Infinite yield possible on 'Workspace.Infl_uenced.UpperTorso:WaitForChild("Small Backpack")'

although it does in fact exist in uppertorso?

heres whats on line 96 (Where the error occurs)

            if GoldAmount.Value >= Item.ItemPrice.Value then
                if player.UserStats.OwnedBackpack.Value ~= Item then

                local Character = player.Character
                local backpack = Item.ItemName.Value

                if oldBag ~= nil then 
                    Character["UpperTorso"]:WaitForChild(oldBag) -- the specified line which it occurs on
                    Character["UpperTorso"][oldBag]:Destroy()
                end

                local backpackPart
                if game.ReplicatedStorage.BackpackLib:FindFirstChild(backpack) then
                    print('found backpack')
                    backpackPart = game.ReplicatedStorage.BackpackLib[backpack]:Clone()
                else
                    print(backpack)
                end

                backpackPart.CanCollide = false
                backpackPart.Parent = Character["UpperTorso"]

                local Weld = Instance.new("Weld", backpackPart)
                Weld.Part0 = Character["UpperTorso"]
                Weld.Part1 = backpackPart
                if backpack == "Starter Backpack" then
                    Weld.C1 = CFrame.new(0, -.2, .5) * CFrame.Angles(0,math.pi,0)
                else
                    Weld.C1 = CFrame.new(0, .2, -.5)
                end
                GoldAmount.Value = GoldAmount.Value - Item.ItemPrice.Value
                player.UserStats.OwnedBackpack.Value = Item.ItemName.Value
                player.UserStats.OwnedBackpackStorage.Value = BackpackModule["BackpacksData"][Item.ItemName.Value][1]
0
The script is probably loading in before the object does. You can instead use FindFirstChild() as a debug. DeceptiveCaster 3761 — 4y
0
I doubt that's the issue as this doesnt happen until you click a button ~ Infl_uenced 0 — 4y
0
can you print oldBag before of waiting for it? EternalScythe 222 — 4y
0
Is this a local or server script? DeceptiveCaster 3761 — 4y
0
@RobloxWhizYT it's a server script, for when a remoteevent is called Infl_uenced 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

So I ended up figuring it out my own after sitting down and attempting to debug the situation heres what I found (be aware this might not be the most efficient way of doing so)

Apparently, the server does not update anything added into bodyparts so you'll have to use fireclient instead and delete it from there :)

Ad

Answer this question