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
|
  |
| Joined: 15 Jun 2015 |
| Total Posts: 1601 |
|
|
| 03 Jul 2016 11:43 AM |
fix this pls it doesnt work
|
|
|
| Report Abuse |
|
|
| |
|
rtrn
|
  |
| Joined: 15 Jun 2015 |
| Total Posts: 1601 |
|
|
| 03 Jul 2016 11:44 AM |
tried that too, it errors.
|
|
|
| Report Abuse |
|
|
|
| 03 Jul 2016 11:45 AM |
#children returns the length of the table
|
|
|
| Report Abuse |
|
|
|
| 03 Jul 2016 11:46 AM |
So that means #children.Torso errors
|
|
|
| Report Abuse |
|
|
rtrn
|
  |
| Joined: 15 Jun 2015 |
| Total Posts: 1601 |
|
|
| 03 Jul 2016 11:46 AM |
mk i think i have a solution
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 03 Jul 2016 11:51 AM |
#children returns the length of the table [2]
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 15 Jun 2015 |
| Total Posts: 1601 |
|
|
| 03 Jul 2016 12:04 PM |
thanks, i already figured it out though.
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|