#[Solved] How to :WaitForChild but not for childs but for properties

35 messages · Page 1 of 1 (latest)

opal prism
#

I have this tool that breaks some parts and makes 2 unions out of it but it seems like it's too fast and the code can't stand that fast so I have to find a way to make like a :WaitForChild(Anchored) of course not with this function. Is there some way?

lilac flint
#

@opal prism union2 == nil

#

It’s not the property

#

If the property isn’t there then it will say something like “(property) isn’t apart of (dotnav to instance)”

opal prism
safe foxBOT
#

studio** You are now Level 10! **studio

opal prism
#

100%

#

it just changes the properties too fast

#

that's why I need somethink like waitforchild

lilac flint
#

Print(union2)

#

This is a common error code

opal prism
#

union2 is a part

lilac flint
#

Print it

#

Just trust me

opal prism
#

ok I'll print it

lilac flint
#

If it returns nil then I owe an apology

opal prism
#

it tries to change the CanCollide but can't find it because the union still don't exist

lilac flint
#

The second it indexes nil it errors

#

Then add a wait in so it waits for the union to exist

opal prism
#

I'll try to move those lines down

lilac flint
#

Or just add a wait in so it waits for the union to exist

opal prism
#

adding a wait will kinda break all the smoothness

lilac flint
#

You just need to yield until the union is added

opal prism
#

what is yield

lilac flint
#

It’s like wait()

#

Yielding means temporarily stopping

#

Then we can make the script wait until certain things have happened

#

e.g. plr.CharacterAdded:Wait() —yields until player has a character

opal prism
#

oh ok

#

like a pcall

lilac flint
#

No pcall calls a function but doesn’t stack end scripts on errors

#

Event:Wait() yields until the event fires

opal prism
#

I ended up with "if union1 then else return end"