Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make a part delete ONLY unanchored parts?

Asked by 4 years ago
Edited 4 years ago

I am making a game that i want the ground to delete unanchored parts but i dont want humaniods to die. I made a script that deletes the parts but i deletes all parts humans, anchored parts, and unanchored parts.

1 answer

Log in to vote
0
Answered by
I_Nev 200 Moderation Voter
4 years ago

This isn't tested and may be a bad way to do it, but i think this may help you

for i,v in pairs(Part:GetTouchingParts()) do
    if v.Anchored == false and not v.Parent:IsA("CharacterMesh") and not v:IsA("CharacterAppearance") then
        v:Destroy()
    end
end
0
Change part to your parts, and put this somewhere where it will keep rerunning or whatever you do to make it delete them I_Nev 200 — 4y
Ad

Answer this question