youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
|
| 10 May 2014 04:55 PM |
function OnTouch(hit) if game.Players:FindFirstChild(hit.Parent.Name) then local player = game.Players[hit.Parent.Name] for i = 100, 0, -1 do wait(0.1) print(i) -- It goes like 46, then when I walk out of the water, it's 97, 41, 99, 36 etc. player.PlayerGui.Breath.Hi.Text = i if player.PlayerGui.Breath.Hi.Text == 0 then game.Workspace[hit.Parent.Name].Head:Destroy() -- Doesn't kill me end end end end game.Workspace.Water.Touched:connect(OnTouch)
function notTouching(hit) local plyr = game.Players[hit.Parent.Name] if game.Players:FindFirstChild(hit.Parent.Name) then plyr.PlayerGui.Breath.Hi.Text = 100 -- The for loop still goes on, this does nothing basiclly. end end game.Workspace.BasePlate1.Touched:connect(notTouching)
|
|
|
| Report Abuse |
|
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
| |
|
youssef04
|
  |
| Joined: 22 Jan 2011 |
| Total Posts: 1745 |
|
| |
|
|
| 10 May 2014 05:15 PM |
player.PlayerGui.Breath.Hi.Text = i
i is a number value, not a string, use this instead.
player.PlayerGui.Breath.Hi.Text = tostring(i)
If there are other situations like this, fix them using tostring() |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 05:17 PM |
function OnTouch(hit) if game.Players:FindFirstChild(hit.Parent.Name) then local player = game.Players[hit.Parent.Name] for i = 100, 0, -1 do wait(0.1) print(i) player.PlayerGui.Breath.Hi.Text = tostring(i) if player.PlayerGui.Breath.Hi.Text == "0" then game.Workspace[hit.Parent.Name].Head:Destroy() end end end end game.Workspace.Water.Touched:connect(OnTouch)
function notTouching(hit) if game.Players:FindFirstChild(hit.Parent.Name) then local plyr = game.Players[hit.Parent.Name] plyr.PlayerGui.Breath.Hi.Text = "100" end end game.Workspace.BasePlate1.Touched:connect(notTouching) |
|
|
| Report Abuse |
|
|