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

Is it possible to repeat checking parent until workspace, then go back by one?

Asked by
RoboFrog 400 Moderation Voter
10 years ago

If the title didn't confuse you enough, I'm curious if this is possible --

Using a FindFirstChild type method, an if statement will check a block's parent (in this case, mouse.Target) until the parent becomes workspace, in which case it'll head back by one. I realize a large issue comes into play about storing, however.

I was thinking about it, and I could see the storage working by storing the last two checked parent's names in string values grouped into the script (possibly even plain variables stated in the script) , and whenever the first string is == to workspace, FindFirstChild in workspace with the name of the second string.

I believe that would work, but the issue comes up with the checking for parent loop -- I'm quite lost on how to achieve this!

I don't need a script written out or something of the sort, I'm mostly looking for how it'd be possible to do! Thank you for reading, and I hope to find a solution.

1
You can use "repeat wait() until something == something". YasuYoshida 171 — 10y

Answer this question