xGOA7x
(Cairo)
January 8, 2023, 5:34pm
#1
Hi,
Although this Involves GUI and should be in
#help-and-feedback:art-design-support
or
#help-and-feedback:game-design-support ,
But It Involves Scripting so I’ll put it here.
I’m not sure how to Title this:
I am Trying to Have A UI bar to stay in the Middle of the UI, Like this:
Full Bar:
Less than Half a Bar:
My Issue is that I’m not sure how to Set this up Properly
Everything I tried would either:
With another Script I had, it would only Stay on the Left side or the Right Side of the Frame
And what I’m trying to achieve is to have it in the Middle,
You can maybe use 2 Frames to create this effect but I want to use 1 Frame, How would I do this with only 1 Frame?
xDeltaXen
(xDeltaXen)
January 8, 2023, 5:35pm
#2
Can you explain it in more detail?
Crygen54
(Crygen)
January 8, 2023, 5:42pm
#3
GUI Changes
Add a “UiGridLayout” inside the black frame.
Put the blue frame inside the black frame.
Set the “UiGridLayout” properties like this:
Here it is
Scripting
Change the bar size using the “UiGridLayout” > CellSize.X(scale)
Example (local script inside the black frame):
local TS = game:GetService("TweenService")
local TI = TweenInfo.new(0.3)
local Goal = {}
local Layout = script.Parent.UIGridLayout
while wait(0.5)do
Goal.CellSize = UDim2.new(0.35, 0 ,1, 0)
local Tween = TS:Create(Layout, TI, Goal)
Tween:Play()
wait(0.5)
Goal.CellSize = UDim2.new(1, 0 ,1, 0)
local Tween = TS:Create(Layout, TI, Goal)
Tween:Play()
end
xDeltaXen
(xDeltaXen)
January 8, 2023, 5:48pm
#4
I just really dont understand what you are asking??
You say you want the bar to be in the middle, but it already is based on the images you provided
unless the one you just sent a moment ago is actually yours, and the initial pictures were an example
if this is the case, I would suggest getting a plugin that positions gui for you, i.e. in middle of screen ill link one in a moment
xGOA7x
(Cairo)
January 8, 2023, 5:53pm
#6
Those are Image of what I’m trying to achieve, and yes, they were an Example
xGOA7x
(Cairo)
January 8, 2023, 5:55pm
#7
With UIGridLAyout
, I’m not able to edit its Size or Position, i hope you realize that
why are you using grid layout? your frame isn’t a scrollingframe
xGOA7x
(Cairo)
January 8, 2023, 5:56pm
#10
That’s what @Crygen54 is saying to do?
Crygen54
(Crygen)
January 8, 2023, 5:56pm
#11
Let’s read my awnser again i edited it ^^
xGOA7x
(Cairo)
January 8, 2023, 6:01pm
#12
Still doesn’t work, it doesn’t even change the CellSize
Crygen54
(Crygen)
January 8, 2023, 6:01pm
#13
Nobody said that a Grid layout should be used only for scrolling frames or for listing multiple Ui… there is many ways to use it
Crygen54
(Crygen)
January 8, 2023, 6:02pm
#14
It work lol, you can test it by yourself:
Gui middle bar.rbxl (33,5 Ko)
xGOA7x
(Cairo)
January 8, 2023, 6:04pm
#15
I’m dumb, I forgot to add the :Play()
to the Tween
Code works now:
Hum:GetPropertyChangedSignal("Health"):Connect(function()
TweenService:Create(HFrame.UIGridLayout,
TweenInfo.new(.2),
{CellSize = UDim2.fromScale(Hum.Health/Hum.MaxHealth,1)}):Play()
end)
Crygen54
(Crygen)
January 8, 2023, 6:07pm
#16
Ah ah no problem mate, hope you will enjoy it ! ^^
1 Like
system
(system)
Closed
January 22, 2023, 6:07pm
#17
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.