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 » Scripters
Home Search
 

Re: Un-Anchoring Tables

Previous Thread :: Next Thread 
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
10 Jan 2015 08:03 AM
I have created a table called parts, and I am trying to get all of those parts UnAnchored.

Hi = true
local a = script.Parent
function OC()
if Hi == true then
Hi = false
Parts.Anchored = false
wait(5)
local new = a:clone()
new.Parent = script.Parent
new:MakeJoints()
Parts.Anchored = true
Hi = true
end
end
game.Workspace.Button2.Part1.ClickDetector.MouseClick:connect(OC)

problem is, nothing is happening when it's clicked!
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
10 Jan 2015 08:04 AM
idk am i blind or what but i cant see a table anywhere
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
10 Jan 2015 08:06 AM
It was 30 lines long, I didn't want it 2 long. just assume it has parts 1-25
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
10 Jan 2015 08:09 AM
Hi = true
local a = script.Parent
function OC()
if Hi == true then
Hi = false
for _,part in pairs(Parts) do
part.Anchored = false -- if there is path to part then do this, else do workspace[part].Anchored = false -- or whatever parent of it is
end
wait(5)
local new = a:clone()
new.Parent = script.Parent
new:MakeJoints()
Parts.Anchored = true
Hi = true
end
end
game.Workspace.Button2.Part1.ClickDetector.MouseClick:connect(OC)
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
10 Jan 2015 08:18 AM
To erase stuff out of a table try this metatable.

local metatable01 = {
_call = function(self)
for i=1, #self do
self[i]:Remove()
table.remove(i)
end
end
}

local table2 = {This is where your parts are}
setmetatable(table2, metatable01)

To clear your table do this:
table2()
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
10 Jan 2015 09:49 AM
I'm afraid it didn't work, but I'm getting an error,

11 is not a valid member of Model

it has been 18, 16, 5, any random part, but I guess I should give you the table...

local Parts = {
[game.Workspace.HitMe.Part1] = 1,
[game.Workspace.HitMe.Part2] = 2,
[game.Workspace.HitMe.Part3] = 3,
[game.Workspace.HitMe.Part4] = 4,
[game.Workspace.HitMe.Part5] = 5,
[game.Workspace.HitMe.Part6] = 6,
[game.Workspace.HitMe.Part7] = 7,
[game.Workspace.HitMe.Part8] = 8,
[game.Workspace.HitMe.Part9] = 9,
[game.Workspace.HitMe.Part10] = 10,
[game.Workspace.HitMe.Part11] = 11,
[game.Workspace.HitMe.Part12] = 12,
[game.Workspace.HitMe.Part13] = 13,
[game.Workspace.HitMe.Part14] = 14,
[game.Workspace.HitMe.Part15] = 15,
[game.Workspace.HitMe.Part16] = 16,
[game.Workspace.HitMe.Part17] = 17,
[game.Workspace.HitMe.Part18] = 18,
[game.Workspace.HitMe.Part19] = 19,
[game.Workspace.HitMe.Part20] = 20,
[game.Workspace.HitMe.Part21] = 21,
[game.Workspace.HitMe.Part22] = 22,
[game.Workspace.HitMe.Part23] = 23,
[game.Workspace.HitMe.Part24] = 24,
[game.Workspace.HitMe.Ball] = 25
}
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
10 Jan 2015 09:54 AM
well it should be

[1] = workspace.HitMe.Part1,
[2] = workspace.HitMe.Part2,
etc

but just changing

for _,part in pairs(Parts) do

to

for part,_ in pairs(Parts) do

might work

Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
10 Jan 2015 09:59 AM
function OC()
for i,v in pairs(workspace.HitMe:GetChildren()) do
v.Anchored = false
end
end

game.Workspace.Button2.Part1.ClickDetector.MouseClick:connect(OC)
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
10 Jan 2015 10:05 AM
I have
for _,part in pairs(Parts) do
workspace.HitMe[part].Anchored = false
end
--(cause that's where it's located)
and I get this error

Workspace.HitMe.Script:34: bad argument #2 to '?' (string expected, got userdata)
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
10 Jan 2015 10:06 AM
You passed in an object as an index.

for _,part in pairs(Parts) do
part.Anchored = false
end
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
10 Jan 2015 10:08 AM
:O It worked!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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