I'm making a plugin that :Destroy()
s scripts when the user clicks a button, and I want to make it so that if you a user presses the Undo button (Ctrl+Z), the script that got just deleted get restored. However, even though I call :SetWaypoint()
after a script is deleted, pressing Ctrl+Z just gives the error message:
The parent property of TestScript is locked, current parent: NULL, new parent Part
I also tried calling :SetWaypoint()
right before I delete the script, but that didn't help either. I know for sure that :SetWaypoint()
is called, I'm guessing it has something to do with the object being gone, but how can I fix it? Am I doing something wrong?
Edit: After I searched up the actual method, I found two things: The official Roblox article says that you need to set the waypoint twice, which is adressed by this post. Anyways, I tried setting the waypoint before, after, and both, all of which give the same results.