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: table is a userdata value

Previous Thread :: Next Thread 
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
24 Apr 2015 07:54 PM
function unanchor(tab)
for k,v in ipairs(tab) do
if v:IsA("BasePart") then
v.Anchored = false
end
end
end
unanchor({base, part})

Error:
10:51:40.455 - Workspace.New.newWeld:4: bad argument #1 to 'ipairs' (table expected, got userdata)

What am I doing wrong?
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
24 Apr 2015 08:00 PM
You did not define the parent of "base" and "part"
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
24 Apr 2015 08:02 PM
all variables defined.
did you even read the error?
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
24 Apr 2015 08:03 PM
when you said unanchor({base,part}) you never defined "base" and "part". So it should be {workspace.base,workspace.part}
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
24 Apr 2015 08:06 PM
This... this is why... oh my god.

Fishguy please leave, we don't need your help.
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
24 Apr 2015 08:08 PM
function unanchor(parts)
if type(parts) == "table" then
for _,part in next, parts do
if part:IsA("Part") then
part.Anchored = true
end
end
end
end

unanchor({base, part})
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
24 Apr 2015 08:09 PM
^ harasser
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
24 Apr 2015 08:09 PM
It worked for me in studio just fine.

function unanchor(tab)
for k,v in ipairs(tab) do
if v:IsA("BasePart") then
v.Anchored = false
end
end
end
unanchor {workspace.Part0, workspace.Part1}
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