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: Can someone help me get this working?

Previous Thread :: Next Thread 
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 09:19 AM
ignore={script.Parent};
people={}
while wait() do
people={}
lol=Region3.new(Vector3.new(-21.9, 1.29, 29.9), Vector3.new(-11.11, 2.29, 18.1))
for _, part in pairs(Workspace:FindPartsInRegion3WithIgnoreList(lol, ignore, 100)) do
if part then
print(part.Name)
if not people[part.Name] then
table.insert(people, part.Name)
end
end
end
end


no output
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 09:28 AM
You're clearing the people table as soon at the start of the loop each time, remove the second "people ={}".

Here's my siggy... Done.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 09:29 AM
You obviously don't understand how this script is supposed to work. I am clearing it, yes... But then I am inserting more into it.
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 09:29 AM
But as soon as the loop ends, it's clearing the table.

Here's my siggy... Done.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Apr 2014 09:30 AM
ignore={script.Parent};
people={}
while wait() do
people={}
lol=Region3.new(Vector3.new(-21.9, 1.29, 29.9), Vector3.new(-11.11, 2.29, 18.1))
for _, part in pairs(Workspace:FindPartsInRegion3WithIgnoreList(lol, ignore, 100)) do
if part then
print(part.Name)
if not people[part.Name] then
people[part.Name]=part
end
end
end
end

The problem was (I think) that you cannot search the values in a list, you have to search by the key. So make the key become part.Name.
I'm not certain that this is what you want, though, because if you have two parts named "Part" then it won't detect the second one.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 09:33 AM
Yeah, no that didn't fix it, thanks anyways
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Apr 2014 09:33 AM
ignore={script.Parent};
people={}
while wait() do
people={}
lol=Region3.new(Vector3.new(-21.9, 1.29, 29.9), Vector3.new(-11.11, 2.29, 18.1))
for _, part in pairs(Workspace:FindPartsInRegion3WithIgnoreList(lol, ignore, 100)) do
if part then
print(part.Name)
valid=true
for _,v in pairs(people) do
if v==part then
valid=false
break
end
end
if valid then
table.insert(people, part)
end
end
end
end

If you want it to detect multiple parts named "Part" then you can do this. Of course, as that one guy said, you will still need to do something with it before the loop ends, which you probably knew.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 09:35 AM
nor that, thnks
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 09:37 AM
ignore={script.Parent};
people={}
while wait() do
lol=Region3.new(Vector3.new(-21.9, 1.29, 29.9), Vector3.new(-11.11, 2.29, 18.1))
for _, part in pairs(Workspace:FindPartsInRegion3WithIgnoreList(lol, ignore, 100)) do
if part then
print(part.Name)
if not people[part.Name] then
table.insert(people, part.Name)
end
end
end
end

Here's my siggy... Done.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 Apr 2014 09:38 AM
But then again, that wouldn't make sense, because why would it even read a part twice? You don't need to validate, since FindPartsInRegion3 only detects each part once?
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 09:39 AM
Nor
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 09:40 AM
@Jared, I am using this for a voting system.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 09:42 AM
I don't see why it isn't working.. IMO
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 09:49 AM
It's because you're clearing the table at the start of the loop, which means everything gets wiped as soon as the loop restarts. You need to get rid of the second "people={}" after the while wait() do.

Here's my siggy... Done.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 11:42 AM
Dude what don't u get about table.insert
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 11:50 AM
table.insert is obviously useless in this script at this point. I need to get it to print the parts' names atleast
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 12:11 PM
Halp
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 12:26 PM
@L0cky Let's review your code...

ignore={script.Parent};
people={}
while wait() do
people={} --THIS IS THE LINE I'M TALKING ABOUT
lol=Region3.new(Vector3.new(-21.9, 1.29, 29.9), Vector3.new(-11.11, 2.29, 18.1))
for _, part in pairs(Workspace:FindPartsInRegion3WithIgnoreList(lol, ignore, 100)) do
if part then
print(part.Name)
if not people[part.Name] then
table.insert(people, part.Name)
end
end
end
end

Because this loop happens, when you insert the values into the table, as soon as they are, it goes and clears them all, because of the line I've pointed out. You need to get rid of that line.

Here's my siggy... Done.
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
20 Apr 2014 12:30 PM
Spongo is correct…
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
20 Apr 2014 12:30 PM
Spong... He needs it to wipe out...
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
20 Apr 2014 12:32 PM
He wipes them out and the wrong time though
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
20 Apr 2014 12:32 PM
@war He could make a voting value which would allow the first loop to run if it's true, if it isn't true, wipe out the table.

Here's my siggy... Done.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 12:33 PM
The issue is that, it isn't even printing the names in the region
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
20 Apr 2014 12:34 PM
1] Why are you using Region3 for a voting system, there are easier ways to do it like changing a value in the player object…
2] You cleared the table right after looping through to get the values to insert… and the loop doesn't really help either
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 12:35 PM
I am not doing touched events. Can someone tell me why it isn't printing the parts in the region?
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