Im tryna have the script wait until it finds the value and makes sure it isn't {}. Should I just use WaitForChild and have the max wait time like 30? Whats the best method?
repeat wait(1) until RS:FindFirstChild('PanelStuff').GameInfo.ServerItemsInfo.Value ~= {}
what you have is probably ok if you’re just looking for one thing every one second, but the most optimal way to do these kinds of things is with a signal. a signal meaning, using Connect()
. with connections you can forget about constant checks, the connect will do it for you without loops, which can save a lot of lag.
it looks like you’re using an Instance. luckily, roblox has a handy-dandy Instance.ChildAdded
event. you can tap into that. if you’re only doing it once, you could even use Instance.ChildAdded:Wait()
.
the best method for me is using for instead of repeat:
for i, v in pairs(RS:GetDescendants) do if v.Name[i] = "PanelStuff" then v.GameInfo.ServerItemsInfo.Value ~= {} end end