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: Anyone know how to make a GUI bar that corresponds to values

Previous Thread :: Next Thread 
Zyphyris is online. Zyphyris
Joined: 03 Feb 2014
Total Posts: 4085
20 Aug 2017 01:22 PM
Put briefly, I'm wondering if anyone can help me with making a GUI bar that will change length based on a NumberValue.


PAC-MAN is real.
Report Abuse
JellyYn is not online. JellyYn
Joined: 02 Sep 2015
Total Posts: 732
20 Aug 2017 01:30 PM
Hmm..
So like, if you had 50 cash, and it changed to 70
the gui bar would change from 50 to 70?

i bump posts from Whenever-2017
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
20 Aug 2017 01:31 PM
just have a frame that's the full size of the bar (have background.Transparency = 1 if you want) then inside that put like a TextLabel or something which is a different colour, (if the bar is horizontal) make the y size (1,0) and the x size (0,0)

then have a script inside the textlabel which says something like:

local bar = script.Parent
local value = --Path to your value
local max_value = --The biggest number the value can be

value:Changed:Connect(function update()
bar.Size = Udim2.new(((value/max_value)),0,1,0)
end)

maybe? :S
Idk im a noob lel
Report Abuse
Zyphyris is online. Zyphyris
Joined: 03 Feb 2014
Total Posts: 4085
20 Aug 2017 01:31 PM
Yes, something similar to that.


PAC-MAN is real.
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
20 Aug 2017 01:35 PM
I need one of these for my game too but I haven't done it yet because i'm still trying to figure out how to save player data :P

Add me on discord Alex301#1904 and i'll send you the script when it's done if you want.. unless the on I just posted works :P
Report Abuse
Zyphyris is online. Zyphyris
Joined: 03 Feb 2014
Total Posts: 4085
20 Aug 2017 02:25 PM
@AlexTheCreator Thanks a bunch man! Although I get an error on the second semicolon in "value:Changed:Connect"


PAC-MAN is real.
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
20 Aug 2017 03:34 PM
is it
Value:Changed():Connect?

Idk if not just split it into 2 variables... like i said I'm new and this is a nooby fix :P

local bar = script.Parent
local value = --Path to your value
local max_value = --The biggest number the value can be
local value_change = value:Changed()

value_change:Connect(function update()
bar.Size = Udim2.new(((value/max_value)),0,1,0)
end)



Sorry if it's still not right :P
Report Abuse
HeIIoISteaIUsernames is not online. HeIIoISteaIUsernames
Joined: 26 Oct 2012
Total Posts: 2906
20 Aug 2017 03:37 PM
value.Changed:Connect()**
Report Abuse
AlexTheCreator is not online. AlexTheCreator
Joined: 10 Jun 2012
Total Posts: 144
20 Aug 2017 03:40 PM
thanks^ :P

Report Abuse
Zyphyris is online. Zyphyris
Joined: 03 Feb 2014
Total Posts: 4085
20 Aug 2017 05:10 PM
@AlexTheCreator The only problem now is that the update function is underlined in red.


PAC-MAN is real.
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