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: No Death Script

Previous Thread :: Next Thread 
QuantumWaffle is not online. QuantumWaffle
Joined: 21 Apr 2011
Total Posts: 95
06 Jul 2016 02:08 PM
When a player reaches 0 or less, i want them to be instantly healed before they can die and to be teleported to a brick of my choice. How?
Report Abuse
Ecyliptical is not online. Ecyliptical
Joined: 01 Feb 2011
Total Posts: 253
06 Jul 2016 02:14 PM
You can't do a script for when they reach "0" health because they'll already be dead.

You'll either:
1.
while wait(0.0001) do
if player.Character.Humanoid.Health < 2 then
player.Character.Humanoid.Health = (whatever value)
player.Character.Torso.CFrame = (whatever part)
Report Abuse
j_ffrey is not online. j_ffrey
Joined: 12 Apr 2015
Total Posts: 262
06 Jul 2016 02:14 PM
"0 or less"
if you have 0, then you will respawn
make it at 1
also its really simple just learn to script a lil today


Report Abuse
QuantumWaffle is not online. QuantumWaffle
Joined: 21 Apr 2011
Total Posts: 95
06 Jul 2016 02:15 PM
Ok. Thank you
Report Abuse
Ecyliptical is not online. Ecyliptical
Joined: 01 Feb 2011
Total Posts: 253
06 Jul 2016 02:16 PM
You can also mess with Roblox PlayerScripts which will probably be more effective but I don't think you're capable of that yet.
Report Abuse
QuantumWaffle is not online. QuantumWaffle
Joined: 21 Apr 2011
Total Posts: 95
06 Jul 2016 02:16 PM
Alright, is there a way I can make it so if your on the red team you got to this block and on green you go to this other block?
Report Abuse
j_ffrey is not online. j_ffrey
Joined: 12 Apr 2015
Total Posts: 262
06 Jul 2016 02:17 PM
http://wiki.roblox.com/index.php?title=AllTutorials


Report Abuse
Thedagz is not online. Thedagz
Joined: 10 Mar 2012
Total Posts: 798
06 Jul 2016 02:32 PM
-- Assuming that this is a local script if not then alter it
-- Make it where each player has more health then 100

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character
local TeleportingPart = "Fill in the blank here this is where the player teleports to"
local NewHealth = 101

Humanoid.MaxHealth = NewHealth
Humanoid.Health = MaxHealth

Humanoid.HealthChanged:connect(function(Health)
if Health <= (NewHealth - 100) then
Humanoid.Health = Humanoid.MaxHealth -- Heals the Player
Character:MoveTo(TeleportingPart.Position) -- Teleports the player to a parts position
end
end)

-- Keep in mind that having a loop that forever runs will cause inconvenient lag so try to avoid that...
-- This is a short code i just came up so it may contain some bugs
Report Abuse
Xsitsu is not online. Xsitsu
Joined: 28 Jul 2009
Total Posts: 2921
06 Jul 2016 02:37 PM
You can disable the dead state of a humanoid directly. This wont prevent their health from reaching zero, but it will stop them from entering the dead state and having their joints broken. I would recommend that this be the approach you take.

local Humanoid = game.Players.Player1.Character.Humanoid
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead)

http://wiki.roblox.com/index.php?title=API:Class/Humanoid
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/SetStateEnabled
http://wiki.roblox.com/index.php?title=API:Enum/HumanoidStateType

Report Abuse
Xsitsu is not online. Xsitsu
Joined: 28 Jul 2009
Total Posts: 2921
06 Jul 2016 02:38 PM
Links may have been bad. Try these:

wiki.roblox.com/index.php?title=API:Class/Humanoid
wiki.roblox.com/index.php?title=API:Class/Humanoid/SetStateEnabled
wiki.roblox.com/index.php?title=API:Enum/HumanoidStateType
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