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: Uh, one piece of command not working D:...

Previous Thread :: Next Thread 
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
23 Nov 2011 01:21 PM
if msg == "rockdeath/flappydavid" then
x = plr.Character:GetChildren()
for i,v in pairs(x) do
if v.ClassName == "Part" then
z = math.random(1,v)
z:remove()
end
end
end

This is a part of a command script that I made that does NOT work... Why is this? I tried z = math.random(1,v) and z = math.random(1,#i)
Report Abuse
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
23 Nov 2011 01:25 PM
Bump.
Report Abuse
tdog158 is not online. tdog158
Joined: 08 Jul 2008
Total Posts: 5413
23 Nov 2011 01:27 PM
z = math.random(1,i)

Don't use #i, since i in this case returns a number, and v returns a value (based on the contents of your table, which in this case are the players.)
Report Abuse
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
23 Nov 2011 01:28 PM
Oh! Thank you.
Report Abuse
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
23 Nov 2011 01:30 PM
Still broken...
Report Abuse
tdog158 is not online. tdog158
Joined: 08 Jul 2008
Total Posts: 5413
23 Nov 2011 01:32 PM
Ah, I see what you are trying to do.

if msg == "rockdeath/flappydavid" then
x = plr.Character:GetChildren()
for i,v in pairs(x) do
if v.ClassName == "Part" then
x[math.random(1,#x)]:remove()
end
end
end
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