Parent property is locked, new parent FakeBackpack

This one was made before but my on answers doesn’t exist because the other topic he never set any parent but in here I have set parent but still getting this weird error, can anyone help me?

The script is basically copying the guns that was recieved from remote events with string and blah blah, then clone guns from server storage into fakebackpack, like everything is working and it often works but sometimes this error appears can anyone help?

game.ReplicatedStorage.Events.ClassHandler.OnServerEvent:Connect(function(player, S , Z, C, Safe)
    if Safe.Parent:IsA("TextButton") and Safe.Parent.Parent.Parent.Parent.Name == "LobbyCamera(Desktop)" and Safe.Parent.Parent.Parent.Parent:IsA("ScreenGui") then
    local classes = game.ServerStorage:WaitForChild("Guns").Classes
				
		
		    for _,v in pairs(classes:GetChildren()) do
			
            if v:FindFirstChild(S) then
   			   classes1 = v:FindFirstChild(S)
			end
			
			
            if v:FindFirstChild(Z) then
   			   classes2 = v:FindFirstChild(Z)
			end
			
			
			if v:FindFirstChild(C) then
   			   classes3 = v:FindFirstChild(C)
			end
			
			
		  end  
		
		
		if classes1:IsA("Tool") and classes2:IsA("Tool")and classes3:IsA("Tool") then
            classes1:Clone()
            classes2:Clone()
            classes3:Clone()
			
				fakes = player:FindFirstChild("FakeBackpack")
			
			if fakes then
				fakes:ClearAllChildren()
				wait(2)
            	classes1.Parent = fakes
				classes2.Parent = fakes
				classes3.Parent = fakes
				player.PlayerGui["LobbyCamera(Desktop)"].Booleans.HasClass.Value = true
				warn("Changed")
			else
				local Fake = Instance.new("Folder", player)
				Fake.Name = "FakeBackpack"


				classes1.Parent = Fake
				classes2.Parent = Fake
				classes3.Parent = Fake
				player.PlayerGui["LobbyCamera(Desktop)"].Booleans.HasClass.Value = true
				warn("I mean, it should be changed u know")
			 end
         end
    else
        player:Kick("Go exploit some where else noob")
    end
end)

are you, at any point, destroying FakeBackpack aka your “fakes” variable? “Parent propert is locked” shows up when you try to parent something that has been destroyed.

1 Like

I never put a variable to destroy it, I just cleared its children then changed parent

Also I checked and the folder exists already

I think I see what the issue is. When you do classesX:Clone(), you never make a reference to the new clone. In stead, you move the actual object classesX into a player’s backpack. Instead, you’ll have to give each clone their own variable so the clone isn’t the same as classesX:

game.ReplicatedStorage.Events.ClassHandler.OnServerEvent:Connect(function(player, S , Z, C, Safe)
    if Safe.Parent:IsA("TextButton") and Safe.Parent.Parent.Parent.Parent.Name == "LobbyCamera(Desktop)" and Safe.Parent.Parent.Parent.Parent:IsA("ScreenGui") then

    local classes = game.ServerStorage:WaitForChild("Guns").Classes
				
		
		    for _,v in pairs(classes:GetChildren()) do
			
            if v:FindFirstChild(S) then
   			   classes1 = v:FindFirstChild(S)
			end
			
			
            if v:FindFirstChild(Z) then
   			   classes2 = v:FindFirstChild(Z)
			end
			
			
			if v:FindFirstChild(C) then
   			   classes3 = v:FindFirstChild(C)
			end
			
			
		  end  
		
		
		if classes1:IsA("Tool") and classes2:IsA("Tool")and classes3:IsA("Tool") then
            class1Clone = classes1:Clone()
            class2Clone = classes2:Clone()
            class3Clone = classes3:Clone()
			
				fakes = player:FindFirstChild("FakeBackpack")
			
			if fakes then
				fakes:ClearAllChildren()
				wait(2)
            	class1Clone.Parent = fakes
				class2Clone.Parent = fakes
				class3Clone.Parent = fakes
				player.PlayerGui["LobbyCamera(Desktop)"].Booleans.HasClass.Value = true
				warn("Changed")
			else
				local Fake = Instance.new("Folder", player)
				Fake.Name = "FakeBackpack"


				class1Clone.Parent = Fake
				class2Clone.Parent = Fake
				class3Clone.Parent = Fake
				player.PlayerGui["LobbyCamera(Desktop)"].Booleans.HasClass.Value = true
				warn("I mean, it should be changed u know")
			 end
         end
    else
        player:Kick("Go exploit some where else noob")
    end
end)
2 Likes