Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
|
| 14 Dec 2013 10:12 PM |
No output errors.
if script.Parent.Parent.Parent.Parent.Character.Head.Position.Y<49 then wait(1) script.Parent.Text = "Oxygen: 9/10" wait(1) script.Parent.Text = "Oxygen: 8/10" wait(1) script.Parent.Text = "Oxygen: 7/10" wait(1) script.Parent.Text = "Oxygen: 6/10" wait(1) script.Parent.Text = "Oxygen: 5/10" script.Parent.TextColor3 = Color3.new(170, 0, 0) wait(1) script.Parent.Text = "Oxygen: 4/10" wait(1) script.Parent.Text = "Oxygen: 3/10" wait(1) script.Parent.Text = "Oxygen: 2/10" wait(1) script.Parent.Text = "Oxygen: 1/10" wait(1) script.Parent.Text = "You have drowned." script.Parent.Parent.Parent.Parent.Character:BreakJoints() wait(.9) script.Parent:remove() elseif script.Parent.Parent.Parent.Parent.Character.Head.Position.Y>=49 then script.Parent.Text = "Oxygen: 10/10" script.Parent.TextColor3 = Color3.new(0, 0, 0) end |
|
|
| Report Abuse |
|
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
|
| 14 Dec 2013 10:31 PM |
That will only run once. Try putting it in a while (wait()) do loop.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
|
| 14 Dec 2013 10:34 PM |
| Now, if I go under water, It counts down. I get out and it continues to count down until I die even if I'm on land above Y: 48 |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Dec 2013 10:39 PM |
local ox = 10 -- Set oxygen to 10
while (wait(1)) do -- Every 1 second if (script.Parent.Parent.Parent.Parent.Character.Head.Position.Y<49) then ox = ox - 1 -- Take 1 away from ox if (ox <= 5) -- If ox is under or equal to five script.Parent.TextColor3 = Color3.new(170 / 255, 0, 0) else script.Parent.TextColor3 = Color3.new(0, 0, 0) end if (ox == 0) then -- If ox is zero script.Parent.Text = "You have drowned." script.Parent.Parent.Parent.Parent.Character:BreakJoints() return -- Just to prevent any errors or mish-mashes end end script.Parent.Text = "Oxygen: "..ox.."/10" end
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
|
| 15 Dec 2013 11:27 AM |
| How would I make the counter reset back to 10 if they're above or equal to 49? |
|
|
| Report Abuse |
|
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
mic144
|
  |
| Joined: 14 Oct 2009 |
| Total Posts: 1598 |
|
|
| 15 Dec 2013 11:38 AM |
if head.Position >=49 then yourstuff.Value = 10 or yourstuff = 10
ect..
-- $$ Get on my level, here use this ladder. Don't fall down on the way up! $$ -- |
|
|
| Report Abuse |
|
|
Adam2090
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
|
| 15 Dec 2013 12:04 PM |
| I understand that part, I don't understand how to add it to that loop. I tried it but it just broke the entire thing. |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 15 Dec 2013 12:07 PM |
Try this. :3
local ox = 10 -- Set oxygen to 10
while (wait(1)) do -- Every 1 second if (script.Parent.Parent.Parent.Parent.Character.Head.Position.Y<49) then ox = ox - 1 else ox = 10 if (ox <= 5) -- If ox is under or equal to five script.Parent.TextColor3 = Color3.new(170 / 255, 0, 0) else script.Parent.TextColor3 = Color3.new(0, 0, 0) end if (ox == 0) then -- If ox is zero script.Parent.Text = "You have drowned." script.Parent.Parent.Parent.Parent.Character:BreakJoints() return -- Just to prevent any errors or mish-mashes end end script.Parent.Text = "Oxygen: "..ox.."/10" end |
|
|
| Report Abuse |
|
|