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
 

confused

Previous Thread :: Next Thread 
rtrn is not online. rtrn
Joined: 15 Jun 2015
Total Posts: 1601
03 Jul 2016 11:43 AM
local children = workspace:GetAllChildren()
for i = 1, #children do
Instance.new("Explosion", #children.Torso)
end


Report Abuse
rtrn is not online. rtrn
Joined: 15 Jun 2015
Total Posts: 1601
03 Jul 2016 11:43 AM
fix this pls
it doesnt work


Report Abuse
OnlySinister is not online. OnlySinister
Joined: 07 Jan 2015
Total Posts: 885
03 Jul 2016 11:43 AM
:GetChildren()


Report Abuse
rtrn is not online. rtrn
Joined: 15 Jun 2015
Total Posts: 1601
03 Jul 2016 11:44 AM
tried that too, it errors.


Report Abuse
OnlySinister is not online. OnlySinister
Joined: 07 Jan 2015
Total Posts: 885
03 Jul 2016 11:45 AM
#children returns the length of the table


Report Abuse
OnlySinister is not online. OnlySinister
Joined: 07 Jan 2015
Total Posts: 885
03 Jul 2016 11:46 AM
So that means #children.Torso errors


Report Abuse
rtrn is not online. rtrn
Joined: 15 Jun 2015
Total Posts: 1601
03 Jul 2016 11:46 AM
mk i think i have a solution


Report Abuse
rtrn is not online. rtrn
Joined: 15 Jun 2015
Total Posts: 1601
03 Jul 2016 11:51 AM
3: attempt to get length of field 'Torso' (a nil value)

im dumb with lau, been focusing on c++ alot more
lua*


Report Abuse
OnlySinister is not online. OnlySinister
Joined: 07 Jan 2015
Total Posts: 885
03 Jul 2016 11:51 AM
#children returns the length of the table [2]


Report Abuse
fghik is not online. fghik
Joined: 06 May 2008
Total Posts: 3288
03 Jul 2016 11:58 AM
It seems like you're going about it in kinda a backwards way.
From the sounds of it, you want to blow up all the players, right?
Rather than comb your workspace with getchildren, why not just do a getchildren in game.Players and use the handy player.Character functionality?

If you'd like to create an explosion in all their torsos,

local players = game.Players:getChildren()
for i = 1,#players do --basically for every player present in the game...
if (players[i].Character == nil) then return end
local torso = players[i].Character:findFirstChild("Torso")
local explosion = Instance.new("Explosion")
explosion.BlastRadius = 10
explosion.BlastPressure = 100000000000000000000
--you know, actually give the explosion some POWER
explosion.Parent = torso
end

May wanna run that through a couple times, I don't code from memory often. But I believe this would be more of what you're looking for. A problem with your original code would be any brick named torso would explode, including things like mechs and building parts and zombies and other things. Plus, finding all the parts would take way more ROBLOX resources than necessary for you to just blow up the players.
Report Abuse
Ptwisted is not online. Ptwisted
Joined: 13 Feb 2013
Total Posts: 568
03 Jul 2016 11:58 AM
I'm assuming you're trying to insert an explosion in all the player's torso?

local players = game.Players:GetPlayers()
for i, player in ipairs (players)do
if player.Character then
local explosion = Instance.new("Explosion", player.Character.Torso)
explosion.Position = player.Character.Torso.Position
end
end


Report Abuse
rtrn is not online. rtrn
Joined: 15 Jun 2015
Total Posts: 1601
03 Jul 2016 12:04 PM
thanks, i already figured it out though.


Report Abuse
MrYelloh is not online. MrYelloh
Joined: 15 Aug 2011
Total Posts: 3842
03 Jul 2016 12:06 PM
you can always shorten :getchildren() to :children(), too

just a little tip


Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
03 Jul 2016 12:07 PM
Assuming you're wanting to explode players:

local Players = game:GetService("Players"):GetChildren())
for _, Player in pairs(Players) do local Explosion = Instance.new("Explosion", game.Workspace) Explosion.Position = Player.Character.Torso
end


-=[ RAP: 334,191 || DurstAuric; the narb of ROBLOX ]=-
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