NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 10 May 2014 05:07 PM |
Localscript, make an IntValue in the player that holds the stamina statistic.
game.Players.LocalPlayer.Character.Humanoid.Jumping:connect(function() num = game.Players.LocalPlayer.Stamina.Value - 1 script.Parent.Text = "Stamina: "..num end) |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
|
| 10 May 2014 05:14 PM |
hum = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Humanoid") hum.Changed:connect(function() if hum.Jump == true then --stuff here end end) |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
|
| 10 May 2014 05:23 PM |
You need an intvalue inside the text thing named Stamina
Script 1:
hum = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Humanoid") hum.Changed:connect(function() if hum.Jump == true then if script.Parent.Stamina.Value >= 1 then script.Parent.Stamina.Value = script.Parent.Stamina.Value - 1 else hum.Jump = false end end)
Script 2:
script.Parent.Stamina.Changed:connect(function() script.Parent.Text = "Stamina: " .. tostring(i) end)
The first two scripts should be in the stamina textlabel/box/button, as well as an IntValue named Stamina. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 05:24 PM |
oops, Script 2 had an error, use this as Script 2 instead.
Script 2:
script.Parent.Stamina.Changed:connect(function() script.Parent.Text = "Stamina: " .. tostring(script.Parent.Stamina.Value) end) |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 05:24 PM |
use an intvalue like above suggested
|
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 May 2014 05:25 PM |
local stamina = 10
while wait(3) do stamina = stamina + 1 end
if stamina > 0 then repeat wait() until game.Players.LocalPlayer.Character.Humanoid.Jump == true stamina = stamina = 1 elseif stamina = 0 then return --and set Jumping false, repeat wait until stamina > 0 end |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 05:27 PM |
repeat wait until stamina > 0
that wouldnt work l0l |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 10 May 2014 05:29 PM |
^Neither would
stamina = stamina = stamina ._. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 05:30 PM |
repeat wait() until game.Players.LocalPlayer.Character.Humanoid.Jump == true
wouldnt work either, could miss it so easily, you'd rather use
humanoid.Changed:connect(function() if humanoid.Jump == true then end end) |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 May 2014 05:34 PM |
Lel fail.
I failed on the stamina = stamina + 1 --[[NOTE THE PLUS SIGN, which is what I wanted to do there.]], but afaik repeat x until y is valid, even if y checks whether a value is above 0.
So repeat wait() until stamina > 0 is valid. It repeats the wait until stamina is greater than 0, and is fired whenever the stamina is at or below 0. (if stamina =< 0 then repeat wait() until stamina > 0 end). |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
| |
|