Why Does My BlackListed Part Get Destroyed?

I’m Making Tool That Allows You To Delete Parts But I Can’t Get My BlackListed Parts To Not Be Able To Be Destroyed. No I Will Not Do A WhiteList For There Is To Many Things I Want Destroyable To Make A WhiteList

/ Here’s The Code /

1 Like

You had a capital D in Blacklisted.

What Do You Mean, There Are No Capitals In It Unless It’s Inside Of The List

image

oops that was from previous attempt but that doesn’t change anything, It still lets u delete parts that should be blacklisted

1 Like

Do you trying? This:

if PartSelected.Name == "BlackListed" or PartSelected:HasTag("BlackListed") or table.find(BlackListed, PartSelected.Name) then

I Like The Idea But When I Try It It Gives This Error

image

what is PartSelected?

Or maybe there is none so it’s error. SO just select a part and try.

Part Selected is a variable that gets set to mouse target to allow it to highlight what you are about to delete

ok have you trying selecting part then seeing if t works?

I’m Confused On What You Are Wanting Me To Try And Do.

What I’m Trying To Do Is When In Game You Can Select A Part In Workspace With Your Mouse, When Your Mouse Is On It It Highlights And When You Click That Part Gets Destroyed.

Ret rghe niyes Nsiey N= Mouse selecte a part and then see this error occurs.

What? I Understood like 7 words. That Being The Last Bit. not trying to be rude it just looks like a lot of misspelled words

Create a table of blacklisted parts:

local Blacklist = {Part.To.Be.Blacklisted}

Then when trying to determine if something is in the blacklist, do this:

if table.find(Blacklist, Part) then return end -- Part here is the part we are checking

Try to replace “print(“NO”)” with return and see if that helps.

1 Like

I’ve Tried That In This Script And It Doesn’t Work

1 Like

I meant, add return on lines 8 and 13.

I Only Saw That After But It Won’t Even Print Anything And Return Makes No Difference

Try using table.find(BlackListed, PartSelected.Name). The issue may be that you are trying to see if a string and an instance match, but they should both be strings.

Nvm

All I Hade To Do Was Replace The Variable With Mouse.Target.Name

You Helped me realize that with the .Name idea

1 Like