Im not quite sure whats causing this, as it shouldnt be checking the startroom to begin with, and second of all, it shouldnt even be able to get to that point, as startroom doesnt even have the DeadEnds folder it needs to check before it even tries adding a DeadEnd.
prevRoom is set to the starting room, and on line 77 its trying to find a deadend cframe point within the starting room. If there isnt one, its just going to error.
You need a FindFirstChild(“DeadEnd”) to verify it exists before trying to pivot to that CFrame.
Did you not read the code? there IS a FindfirstChild(“DeadEnds”). The DeadEnds are stored in a folder called DeadEnds in the rooms that have them. Startroom isnt one of those rooms, so it shouldnt be having this issue, because it doesnt HAVE a deadend.
You are using FindFirstChild on the new room, not the previous. Besides, you are searching for DeadEnds, not DeadEnd, which is what you are trying to find on line 77
…Again, did you not read? Thats the point. Im trying to get Deadends on the NEW room. not the old room, which is why this error shouldnt be happening. And, like i said in the last reply, The DeadEnd is stored in a folder called DeadEnds
Deadends folder is always going to exist no matter what, so you should add a condition to check if there are any dead ends inside the folder to begin with.
You are trying to index the previous room with DeadEnd on line 77. You are probably setting the previous room to be the starting room, and this error is happening after the first room is created.
All you would need to do is check if the previous room even has a DeadEnd, which you dont seem to be doing. You are only checking if the NEW ROOM has a dead ends FOLDER, which is not the same thing.
…You had it backwards. I was TRYING to check the new room. Trying to add it to the previous room was an oversight (I copied and pasted this generation code from another part of the script and forgot to change the prevroom.pivot)