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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What's the most script efficient way to kill a player.

Previous Thread :: Next Thread 
nickbricknick464 is not online. nickbricknick464
Joined: 22 Aug 2008
Total Posts: 8302
09 Aug 2012 04:31 PM
Would it be setting the player health to 0 or :BreakJoints etc?
Report Abuse
lucas668 is not online. lucas668
Joined: 18 Jun 2008
Total Posts: 6183
09 Aug 2012 04:33 PM
Workspace.Character.Head:Destroy()
Report Abuse
GigsD4X is not online. GigsD4X
Joined: 06 Jun 2008
Total Posts: 3794
09 Aug 2012 04:37 PM
I doubt removing the head is very efficient. It may break badly written scripts that are working with the head. I think setting the health to 0 would be a better idea.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
09 Aug 2012 04:37 PM
Player:RemoveCharacter()

If only...
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
09 Aug 2012 04:42 PM
Setting the head's parent to nil would be my best answer to this. You don't have to call a method for it and it gets (pretty instantly) garbage collected internally if I know anything about how characters work.
Report Abuse
darkari805 is not online. darkari805
Joined: 06 Aug 2011
Total Posts: 12915
09 Aug 2012 04:52 PM
Workspace.YOURNAMEHERE.Head:Remove() i think this is good
Report Abuse
Techboy6601 is not online. Techboy6601
Joined: 29 Jun 2009
Total Posts: 4914
09 Aug 2012 04:53 PM
@dark

*facedesk*
*facepalm*
*facebook*

get.

out.
Report Abuse
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
09 Aug 2012 05:47 PM
pcall(function() Humanoid.Health = 0 end)

?


☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance.
Report Abuse
pwnedu46 is not online. pwnedu46
Joined: 23 May 2009
Total Posts: 7534
09 Aug 2012 06:49 PM
Players.Player.Character:BreakJoints()
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
09 Aug 2012 06:50 PM
@pwned

You're using a method, instantly less efficient.
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
09 Aug 2012 06:56 PM
I understand why people need more efficient scripts but why do you need to kill people?

It only really matters if you want to kill hundreds of people at once, since it takes the a few seconds to respawn.
Report Abuse
GoldNHeart is not online. GoldNHeart
Joined: 26 May 2012
Total Posts: 3103
09 Aug 2012 07:54 PM
I think either:
1. Removing their head: game.Workspace.USERNAME.Head:Destroy()
or 2. Setting their health to 0: game.Workspace.Humanoid.Health = 0

I think I may have missed something in there, so sorry, I'm jus a beginning scripter..
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
09 Aug 2012 07:55 PM
"game.Workspace.Humanoid.Health = 0"

no, for so many reasons.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
09 Aug 2012 08:00 PM
"You're using a method, instantly less efficient."

Roblox uses meta-methods to check for changes when you assign a value to a property. You're using a method either invisibly or visibly.
Report Abuse
Techboy6601 is not online. Techboy6601
Joined: 29 Jun 2009
Total Posts: 4914
09 Aug 2012 08:51 PM
This is how is should be done:

game.Workspace.Player.Humanoid:TakeDamage(100)

because why not
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
09 Aug 2012 08:54 PM
Because I just set the humanoid's health to 101 and because that checks for forcefields before doing damage.
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
09 Aug 2012 09:01 PM
game.Players.PlayerName.Character.Parent = nil. Gets rid of all the hassle of moving parts and stuff
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
09 Aug 2012 09:12 PM
@popinman

You don't have to call a Lua method (let's just call it a function call, because that's what methods are) though. I'm sure that changing properties is deeper in the code (like the C-side of things), amirite?
Report Abuse
GigsD4X is not online. GigsD4X
Joined: 06 Jun 2008
Total Posts: 3794
09 Aug 2012 09:15 PM
@aboy It would fire events like Changed, too.
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
09 Aug 2012 09:17 PM
We're really getting into micro-optimizing now.... Let's stop. It's a pointless argument because we're not writing the C code which is where all of the improvements seem to be.
Report Abuse
jAlternate is not online. jAlternate
Joined: 02 Dec 2011
Total Posts: 234
09 Aug 2012 09:19 PM
Player:LoadCharacter()

It's so efficient that the player respawns instantly before even realizing what is going on!
Report Abuse
GigsD4X is not online. GigsD4X
Joined: 06 Jun 2008
Total Posts: 3794
09 Aug 2012 09:20 PM
That is true. Plus, it's not like he's going to be killing thousands of people in less than a second. Unless........ ...
Report Abuse
Techboy6601 is not online. Techboy6601
Joined: 29 Jun 2009
Total Posts: 4914
09 Aug 2012 09:25 PM
@jAlternate

Isn't LoadCharacter locked?
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
09 Aug 2012 09:41 PM
Maybe he wants 10000 AI bots and is making a nuke script?
Report Abuse
OwneD1991 is not online. OwneD1991
Joined: 16 Oct 2009
Total Posts: 12623
09 Aug 2012 09:57 PM
@Tech,

its not locked
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