The Parent Property of Monster error

Hello!

I am having an issue where whenever a new round starts, there is a chance for the Monster to spawn twice every round, but whenever that happens the timer is stuck at one second and then an error comes up with “The Parent property of Big Cube is locked, current parent: NULL, new parent Workspace”, and then when I click where the error is occuring it shows me this:

  local chosen = BigCube[math.random(1, #BigCube)]
  chosen.Parent = workspace
  Status.Value = The ..chosen.Name.. is here! Survive!

The chosen.Parent = workspace line works fine whenever its a different monster that spawns but if it is the same one the round system breaks and it stops working!

I don’t know what to do and I thought using the WaitForChild function would fix this problem, but it wouldn’t and the first round would just freeze on one second with no error.

How can I fix this problem?

Do you call Destroy on chosen at some point in your code or it gets destroyed by something else? If that does happen, that will lock the Parent property and raise the error you mentioned so you should clone the instance retrieved from the BigCube[math.random(1, #BigCube)] before parenting it to workspace to prevent this from happening:

local chosen = BigCube[math.random(1, #BigCube)]:Clone()
chosen.Parent = workspace

Yes I do destroy it at some point, thank you for helping! It works fine now!