Recieving Error that seems like it shouldn't be physically possible

This line of code:
image

Keeps giving me the following error.

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.

Does the model have a part or something named “DeadEnd”?

No, and thats the point. It should only perform lines 69 - 81 if there IS. and there isnt, so the fact theres an error at 77 shouldnt be possible.

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

1 Like

Why does it look like line 69 has a space after DeadEnds ?
Kinda confusing when you use DeadEnd and DeadEnds as variables.

…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

Not sure, there isnt a space. I checked.

Also, yes, i know its confusing, im a messy writer, sorry.

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.

No, the DeadEnds folder wont exist no matter what, because only certain rooms have them. Thats the point of the code, thats what its checking.

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.

1 Like

prevRoom is Workspace.Startroom, is that intentional?

1 Like

…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)

can we see the rest of the code? deadend is part of prevroom which seems to be a parameter, what is it supposed to be?

No, that was an acident, i didnt mean to. im facing another issue, but it seems pretty easy to fix. Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.