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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 03 Feb 2014 |
| Total Posts: 4085 |
|
|
| 20 Aug 2017 01:31 PM |
Yes, something similar to that.
PAC-MAN is real. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
| |
|
| |
|
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 |
|
|