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
 

Would This Work?

Previous Thread :: Next Thread 
dpearce is not online. dpearce
Joined: 16 Oct 2011
Total Posts: 546
14 Jul 2014 07:20 AM
I want all the players in game to die....
Im new at scripting so...


local bob = game.Workspace.Players:GetChildren()

bob.Torso:Destroy()
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
14 Jul 2014 07:23 AM
I can see this is for malicious purposes
Report Abuse
dpearce is not online. dpearce
Joined: 16 Oct 2011
Total Posts: 546
14 Jul 2014 07:25 AM
No...

Im working on a script for my game....

It will change the team of all the players then kill them...
Report Abuse
dpearce is not online. dpearce
Joined: 16 Oct 2011
Total Posts: 546
14 Jul 2014 07:28 AM
Can anyone help me with this?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Jul 2014 07:33 AM
Well, It would work if:
There is a model in Workspace named Players.
Torso is a variable defined beforehand.

Here is what this looks like:

game.Workspace.Players
Typically, there is no "Players" model in Workspace. But assuming there was, and there were everyone's characters in it, here is what would happen:

:GetChildren()

Now we have:

{WishNite's Character, dpearce's Character, JarodOfOrbiter's Character}

Notice Torso is not a member here, and even if we could access it, you are deleting everyone's torsos, not just bob's.


To correct the whole script for you, do this:

game.Workspace["PlayerNameHere"].Torso:Destroy()

The reason for the brackets is it works with names with spaces, and names that begin with numbers.

Last step - In case the guy's torso is already deleted or his character doesn't exist yet, the script won't break:

local Player = game.Players["PlayerNameHere"]
if Player.Character and Player.Character:FindFirstChild("Torso") then
Player.Character.Torso:Destroy()
end

You did a good job with Lua Syntax, but your directory knowledge is what you should work on, just as a constructive criticism.
Report Abuse
dpearce is not online. dpearce
Joined: 16 Oct 2011
Total Posts: 546
14 Jul 2014 07:39 AM
@Jacob Thanks, but i want it to kill all the players ingame...

How about this:

local playernames = game.Players:GetChildren()

game.Workspace.playernames.Torso:Destroy()
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
14 Jul 2014 07:42 AM
Stop spamming threads.
One is enough.
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