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
 

Re: Can someone give me an example?

Previous Thread :: Next Thread 
DeGames is not online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
23 Jan 2016 11:03 AM
Of a script that will damage one "Player" and not "Player2"
Report Abuse
IllegallyBlind is not online. IllegallyBlind
Joined: 07 Nov 2010
Total Posts: 1691
23 Jan 2016 11:06 AM
game.Players["Player"].Character.Humanoid.Health = 90


i make u math.sqrt()
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
23 Jan 2016 11:09 AM
@IllegallyBlind that doesn't damage anyone, that just sets their health to 90

if "Player" has less than 90 health, you're healing them

he needs to do:

game.Players["Player"].Character.Humanoid:TakeDamage(10) if using your code setup
Report Abuse
IllegallyBlind is not online. IllegallyBlind
Joined: 07 Nov 2010
Total Posts: 1691
23 Jan 2016 11:10 AM
@above

I understand that, I'm just too lazy to write out that entire boring line. :^)


i make u math.sqrt()
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
23 Jan 2016 11:11 AM
he really should be waiting for the character, though, when using your setup
Report Abuse
firelordofengland is not online. firelordofengland
Joined: 22 Dec 2008
Total Posts: 145
23 Jan 2016 11:28 AM
HP = game.Players["Player"].Character.Humanoid.Health
MinHP = 0

if HP > MinHP then
wait(.5)
HP = HP - 2
end





^ Try that. You can set the MinHP variable to the minimum HP you want them left with if you don't want to kill them, otherwise leave it at 0 to kill them.
Report Abuse
firelordofengland is not online. firelordofengland
Joined: 22 Dec 2008
Total Posts: 145
23 Jan 2016 11:29 AM
^ nevermind forgot loop.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 11:30 AM
"HP = HP - 2"
HP is not a pointer to Health though. HP is its own value, not linked to Health.
Report Abuse
firelordofengland is not online. firelordofengland
Joined: 22 Dec 2008
Total Posts: 145
23 Jan 2016 11:36 AM
Then would,


game.Players["Player"].Character.Humanoid.Health = HP


make HP the players health value?

If so then this should work,


game.Players["Player"].Character.Humanoid.Health = HP
MinHP = 0 -- AKA Dead

while HP > MinHP do
wait(.5)
HP = HP - 2
end
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Jan 2016 11:41 AM
No, that's sort of worse since HP is nil.


H = game.Players["Player"].Character.Humanoid
MinHP = 0 -- AKA Dead

while H.Health > MinHP do
wait(.5)
H.Health = H.Health - 2
end
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