Problems with Serverlist: The parent property of Template is locked, curent parent: NULL, new parent Holder

Hey!

I’m trying to create a serverlist for my game, but it doesn’t work when another server is active, giving me the error ‘The parent property of Template is locked, curent parent: NULL, new parent Holder’ although when I researched the error, I found nothing that helped me. The system works like this: Checks for running servers from a folder which provides the data, sends it to the client, and loads all of the servers and their data under the list. It deletes the outdated frames and replaces them with new frames with the proper data.
NOTE: When I only set the Frame’s parent to nil, the script proceeds as per usual. When I delete it, it doesn’t.
PROBLEM LINES:

for i,v in pairs(ServersList:GetChildren()) do
	if v:IsA("Frame") then
		v.Parent = nil
		v:Destroy()
	end
end

for i, Server in pairs(ServerFrames) do
	Server.Parent = ServersList
end
1 Like

You cant set it as nil and destroy it, when its parent is nil the item is already nil / destroyed

Same error occurs with or without the nil it doesn’t matter I put it there to play around

1 Like

Which line is the error on when it occured?

	Server.Parent = ServersList

Just do

v:Destroy()

Remove this line

v.Parent = nil

Can you show me the whole script?

Why are you trying to set the parent of a destroyed object?? The .Parent property gets locked when you call destroy because you are deleting it from memory.

It’s not parenting the deleted object I checked.

It creates a table, places the frames in it, and then reparents them to the frame.

There is not a single place where it destroys the servers in the table.

What is ServerFrames set to?