|
| 24 Jan 2014 07:12 PM |
script.Parent.Touched:connect(function(Part) if Part.Name == "Remove" then Part:Destroy() end end)
I want this script to destroy all blocks that are NOT named a certain name, with a list of excluded block names.
Thanks in advance! |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2014 07:14 PM |
Use ~=, its the opposite of ==:
if a.Name ~= "B" then --if a is ANYTHING but B then
if c.Name ~= "DE" and c.Name ~= "A" then --if its neither DE nor A then |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2014 07:15 PM |
Yes, I know about ~=, but the thing is I want a list of excluded names. I tried to make one, but I couldn't figure it out.
Thanks for your answer though! |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2014 07:16 PM |
script.Parent.Touched:connect(function(Part) if Part.Name = nil then remove
function remove(part) nil= Game.Workspace.Part = remove
|
|
|
| Report Abuse |
|
|
|
| 24 Jan 2014 07:17 PM |
Oh, use this then:
list = {"1", "2", "C", "D"} --you get the drill
function isInList(name) for i, v in pairs(list) do if v == name then return true end end return false end
if isInList(player.Name) then print "Sadly he is in the list" end
or
if not isInList(player.Name) then print "He's not on the list guys!" end |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2014 07:17 PM |
| That one isn't even written in LUA... |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2014 07:18 PM |
| I was replying to xxu, thanks! |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 24 Jan 2014 07:20 PM |
script.Parent.Touched:connect(function(plr) if plr.Parent:FindFirstChild("Humanoid") ~= nil then for i,v in pairs(game.Workspace:GetChildren()) do if v.Name == "PartNameHere" then v:Destroy() end end end end) |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2014 10:32 PM |
Game.Workspace.Part =nil function (OnTouch) Game.Workspace.Baseplate = Part nil (OnTouch) nil= part nil= baseplate nil= part (OnTouch)nil=baseplate remove(part) -- I have tried this once and it worked! |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
| |
|