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 » Scripting Helpers
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
10 May 2014 05:04 PM
[ Content Deleted ]
Report Abuse
Goulstem is not online. 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 is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
10 May 2014 05:12 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
10 May 2014 05:13 PM
[ Content Deleted ]
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
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 is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
10 May 2014 05:18 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
10 May 2014 05:19 PM
[ Content Deleted ]
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
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
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
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
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
10 May 2014 05:24 PM
use an intvalue like above suggested

Report Abuse
powertool is not online. 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
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
10 May 2014 05:27 PM
repeat wait until stamina > 0

that wouldnt work l0l
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
10 May 2014 05:29 PM
^Neither would

stamina = stamina = stamina ._.
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
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 is not online. 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 is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
10 May 2014 05:43 PM
[ Content Deleted ]
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
10 May 2014 05:45 PM
Do what my post said..
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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