generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How can I adapt this script?

Previous Thread :: Next Thread 
InfinitePears is not online. InfinitePears
Joined: 14 Apr 2012
Total Posts: 431
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
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
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
InfinitePears is not online. InfinitePears
Joined: 14 Apr 2012
Total Posts: 431
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
XxUMADBROSXx is not online. XxUMADBROSXx
Joined: 18 Oct 2013
Total Posts: 22
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
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
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
InfinitePears is not online. InfinitePears
Joined: 14 Apr 2012
Total Posts: 431
24 Jan 2014 07:17 PM
That one isn't even written in LUA...
Report Abuse
InfinitePears is not online. InfinitePears
Joined: 14 Apr 2012
Total Posts: 431
24 Jan 2014 07:18 PM
I was replying to xxu, thanks!
Report Abuse
Goulstem is not online. 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
XxUMADBROSXx is not online. XxUMADBROSXx
Joined: 18 Oct 2013
Total Posts: 22
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 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
24 Jan 2014 10:33 PM
That was writtin in Lua.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image