I was designing a progress bar to display the Speed of a vehcile, and im using UiCorner for the rounder corners. But, the ui corners doesn’t clip its descendents. So, i tried to make a workaround. I tried to make the parent frame (name it frame 1) size in offset (pixels) and the child frame (frame 2) size in scale, then its child (frame 3) the size in offset same to frame 1.
The problem with that approach is that its small in offset size, and if using scale, the entire thing breaks.
For using scale size for frame 1, i tried resizing frame 3 by its AbsoluteSize
code
script is placed in frame 3
local RunService = game:GetService("RunService")
local frame3 = script.Parent
local frame1 = frame3.Parent.Parent
RunService.RenderStepped:Connect(function())
local frameSize = frame1.AbsoluteSize
frame3.Size = UDim2.new(0, frameSize.x, 0, frameSize.y)
end)
The following code doesnt work for me, any help is appreciated.
The container should have a rounded corner, i dont want the progress bar to be rounded, in html and css, it works cause css clips the corners also, but in roblox i use a workaround which only works if the container is in offset size
Not quite sure what your goal is, but I think you’re approaching this the incorrect way. The only UI element that is locked(to my knowledge) with using only offset is UIStroke.
As far as I understand, you wish your UI to scale correctly on all devices?
If so in what way?
Do you have any pictures of your current setup? It is hard to imagine your issue with only text.
This was achieved with only UI elements(besides star pattern), and uses scale for all devices, with added pixels to compensate for smaller screens.
The current setup is the game you were on the train ui, only the ui cointainer should have ui corner, and i forgot to say also the frame 3 also have ui corner.
I couldnt update now as im in mobile, i could update later this day or maybe now (my laptop has a problem wher it sometime boots and womtimes WHEN MOOVED A LIL, battery disconnects and dead, have to reconnect the battery and sometime it doesnt charge .–.)
The best thing would be if you exported the GUI in scale format, so I could take a in-depth look at where the issue lies and in what way it stops working.
Im updating the game right now, my laptop has started up, if you want more detail, ill export the progress gui
be sure to see last updated, if it was today, then the throttle ui shoule have its container scaled, also im going to make a new script to try and fix the issue
EDIT: I was too late, but I will post it just in case. GG on solving it.
Frame3 has to be in offset, as otherwise it will adjust to the size of frame2.
The solution would be to connect to the frame1AbsoluteSize property changed signal.
local function OnSizeChanged()
frame3.Size = Udim2.new(0,frame1.AbsoluteSize.X,0,frame1.AbsoluteSize.Y)
end
frame1:GetPropertyChangedSignal('AbsoluteSize'):Connect(OnSizeChanged)
--run it once on start
OnSizeChanged()