I am currently unable to delete a part (PrimaryPart) and roblox seems to also show it wrong in the properties window.
After i clone a room, i assign it a primary part to move it. After the room gets moved, the primary part is supposed to get deleted. Problem is: The PrimaryPart is not getting deleted. When printing the part after the Destroy line, it outputs the correct part into console (part name), but in the properties of the model, the PrimaryPart Box seems empty. When trying to change Properties like the BrickColor it also won´t work. The Part “chosenExit” is correctly destroyed.
I already tried to unassign the primary part and then deleting the part but that also did not work.
Any help would be appeciated! Here is the relevant part of the code:
Its probably because you didn’t remove any references to chosenExit after destroying it, so the garbage collector still considers it as a relevant variable in memory. Try:
chosenExit is getting destroyed how it is supposed to. I am having Problems with spawnedRoom.PrimaryPart:Destroy().
trying to nil that won´t help.
Edit: i basically have 2 parts indicating the position of a doorway to connect rooms. These two parts need to be destroyed after i move a room to the given doorway. The Part of the static room (chosenExit) is getting deleted how it is supposed to. The Part of the copied and moved room (spawnedRoom.PrimaryPart) won´t be destroyed and can not be altered with properties. It does get printed as the correct part though.
Try setting it to nil without destroying it spawnedRoom.PrimaryPart = nil
if that doesn’t work try using Debris game.Debris:AddItem(spawnedRoom.PrimaryPart)
Okay, setting the PrimaryPart to nil, sets the property PrimaryPart to nil. When i after that try to delete the part (assigned it a new variable to keep track of it) it is still staying. Debris also won´t work.
I have also tried Remove() earlier even though it is deprecated and it also does not work.
when i try and access spawnedRoom.PrimaryPart from the console it is nil if i have spawnedRoom.PrimaryPart:Destroy() enabled. It returns the part if i disable the Destroy() line.
Maybe you can’t destroy the PrimaryPart of a model?
Try naming the Part something like PlacementPart and destroying Model.PlacementPart.
Or why even destroy it? Just make it Transparent CanCollide off.
“PrimaryPart” is a property used by roblox. You can make PrimaryPart any Part of the model. You can access the set PrimaryPart with model.PrimaryPart. The problem is that the part is not getting destroyed.
the parts names are different.
I have tried setting the PrimaryPart nil and then destroy the part which was the primary part.
I also can not edit any properties of the part in the script for some reason. When changing BrickColor through output/console it works. What?
destroying it makes it nil as primarypart but the part still remains in the workspace. I also am not able to change any properties of the part in the script for some bizarre reason.