I'm trying to change the size of a Frame using a UDim2 value, and the problem is I want some values to remain constant. I'm also trying to use scale instead of offset, so the GUI fits universally.
Here's the script:
coroutine.resume(coroutine.create(function() time = fuel/10 while not trigger and fuel < 100 do time = tick() - time fuel = time*10 if fuel > 100 then fuel = 100 end fuelbar.Size = UDim2.new(fuel*2,0,Y,0) --I need a way to substitute the y-scale size value in for Y game:GetService("RunService").RenderStepped:wait() end end))
If I understand the question correctly, you want the Y scale size to be a constant. In that case, you literally substitute the Y with a constant, like so:
coroutine.resume(coroutine.create(function() time = fuel/10 while not trigger and fuel < 100 do time = tick() - time fuel = time*10 if fuel > 100 then fuel = 100 end fuelbar.Size = UDim2.new(fuel*2,0,0.2,0) -- Here, I replaced the Y with a constant, in this case 0.2 game:GetService("RunService").RenderStepped:wait() end end))
I was able to answer my own question by digging a little deeper into the roblox wiki. The scale of a UDim2 value can be specified like so:
local v = UDim2.new(0,0,v.Size.Y.Scale,0)