|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 12 Apr 2015 |
| Total Posts: 262 |
|
|
| 06 Jul 2016 02:17 PM |
http://wiki.roblox.com/index.php?title=AllTutorials
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|