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 » Scripters
Home Search
 

Re: How do I script a Hunger and Thirst GUI?

Previous Thread :: Next Thread 
yoshi34925 is not online. yoshi34925
Joined: 25 Feb 2013
Total Posts: 618
21 Jun 2015 01:35 AM
I also need to know how to put it into food.
Report Abuse
yoshi34925 is not online. yoshi34925
Joined: 25 Feb 2013
Total Posts: 618
21 Jun 2015 01:37 AM
Also, I will do this myself.
Report Abuse
xSpectrumWolfx is not online. xSpectrumWolfx
Joined: 30 Nov 2011
Total Posts: 2858
21 Jun 2015 02:18 AM
In order to do a hunger and thirst GUI first you need a Frame to contain a image, and in the same frame a text label. You could make the text update to be the percentage but that is obviously up to you.

- Frame
-- Image
-- Text

Anyways, basically you will be making a MaxHunger, MaxThirst, Thirst, and Hunger variable.

So for example:

MaxHunger = 100
Hunger = MaxHunger <-- You will want to load this probably on start up so you will just update the hunger.

You will need a constant loop, such as a while loop.

while Hunger ~= 0 and Thist ~= 0 then wait(1)


And within this, you will want to update the variable by negating it.

Hunger = Hunger - 1

Then you will change your images size, which will be the your Y axis.

MyUI.Size = UDim2.new(0,1,0, (Hunger / MaxHunger))

That should be the math forumula to get the percentage of your Hunger and Thirst. Current divided by Max (100). You may need to play around with the size. I don't use ROBLOX anymore, I use Unreal Engine 4 and I have this, and made it on ROBLOX before.

Hope this helps, cheers.
Report Abuse
yoshi34925 is not online. yoshi34925
Joined: 25 Feb 2013
Total Posts: 618
21 Jun 2015 02:23 AM
bump
Report Abuse
yoshi34925 is not online. yoshi34925
Joined: 25 Feb 2013
Total Posts: 618
21 Jun 2015 02:35 AM
I'd like to know how to use that with food and drinks so I can replenish my hunger/thirst.
Report Abuse
daireb is not online. daireb
Joined: 16 Nov 2012
Total Posts: 726
21 Jun 2015 03:05 AM
U even script bro?

The solution is called addition
Report Abuse
ssd21345 is not online. ssd21345
Joined: 28 Jan 2009
Total Posts: 5985
21 Jun 2015 04:15 AM
Use ontouch.Localscript.
Report Abuse
xSpectrumWolfx is not online. xSpectrumWolfx
Joined: 30 Nov 2011
Total Posts: 2858
21 Jun 2015 10:55 AM
I'd appreciate it if you could of told me thanks, or something to let me know I helped you. Like everyone else is saying, it's called addition but I'm not going to be specific with it.

Look up a tutorial or script someone has already and learn from how to use it maybe.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
21 Jun 2015 10:57 AM
TweenSize.

http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenPosition
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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