I’m trying to make it so when the player presses a key, this frame (image below) would tween across to the right each click, if they stop clicking then it will begin to decrease back to the original size.
Original Size
: {0.508, 0},{0, 0}
Max Size
: (size to stop at) {0.508, 0},{0.953, 0}
Trying to achieve an effect similar to this.
Here’s the current code for increasing when clicking;
local originalSize = UDim2.new(0.508, 0, 0, 0)
local maxSize = UDim2.new(0.508, 0, 0.953, 0)
local incrementSize = UDim2.new(0.508, 0, Gui.Frame.Progress.Size.Y.Scale + 0.100, 0)
local decrementSize = UDim2.new(0.508, 0, Gui.Frame.Progress.Size.Y.Scale - 0.100, 0)
local newSize = progressFrame.Size + incrementSize
if newSize.Y.Scale > maxSize.Y.Scale then
newSize = maxSize
end
local increaseTween = TweenService:Create(progressFrame, tweenInfo, {Size = newSize})
increaseTween:Play()
And here’s the current code for decreasing for not clicking;
local originalSize = UDim2.new(0.508, 0, 0, 0)
local maxSize = UDim2.new(0.508, 0, 0.953, 0)
local incrementSize = UDim2.new(0.508, 0, Gui.Frame.Progress.Size.Y.Scale + 0.100, 0)
local decrementSize = UDim2.new(0.508, 0, Gui.Frame.Progress.Size.Y.Scale - 0.100, 0)
local newSize = progressFrame.Size + decrementSize
if newSize.Y.Scale < originalSize.Y.Scale then
newSize = originalSize
end
local decreaseTween = TweenService:Create(progressFrame, tweenInfo, {Size = newSize})
decreaseTween:Play()
i rushed so idk if im doing something wrong here or not