Repeat until value not nil

How do I use repeat until a value is not nil, I am trying to do this but it is not working

local robotName = sellOrder:FindFirstChildWhichIsA("StringValue")
		
repeat wait() until robotName == sellOrder:FindFirstChildWhichIsA("StringValue")

Edit* all I had to do was switch the two lines around, and it worked

You’re looping for something that doesn’t exist.
Instead, take the name of it and use WaitForChild():

local robotName = sellOrder:WaitForChild("StringValue")

I am not using WaitForChild because the name of my string value is a UID

That doesn’t mean anything.

In my example, the variable halts the script until it exists.

repeat wait() until robotName == sellOrder:FindFirstChildWhichIsA(“StringValue”) ~= nil

(i think, not sure if it’ll do)

Anyways I already fixed the problem, so it doesn’t really matter now

Thanks for helping! But I already fixed the glitch

The way you did it is unnecessary, but alright…

oh whoops didnt see the solution lol, yw

1 Like

It still works thought so…
char limit

what he is saying is, it works but its recommended to use his method

I’ll try out his method as well right now!

This is not working it is saying,

--Infinite yield possible on 'ReplicatedStorage.SellOrders.{1389D881-B01F-472C-94FB-7DE6516BB2F0}:WaitForChild("StringValue")'

That’s because you didn’t retitle the name of the value to the ACTUAL value’s name, silly!

Like I’m saying the name of the value is a UID so it is completely random so I can not retitle the name

Use player.UserId for finding the value then. It’s not that hard…

You are misunderstanding me a LOT.
The string value’s name is a UID(not the player id)
So it is a 32-hexadecimal-value which is never the same each time you play the game, so if the player id is 1111112, the UID can be {1389D881-B01F-472C-94FB-7DE6516BB2F0}

You do you, but using a hex value seems strange. I don’t have any extra context on what it’s supposed to do, so I guess I shouldn’t be picky.

Also, UID can be confused with user id (not called player id btw), plus I didn’t originally have any idea on what the other version of a UID is.

I called it player id so you won’t misunderstand me another time.