I'm trying to make a QTE function in Roblox

I’m trying to make a button-mash type QTE, but for some reason, the frame won’t tween.

local UIS = game:GetService("UserInputService")
local fill = script.Parent.qte.fill

UIS.InputBegan:Connect(function(input)
    local X = fill.Size.X.Scale
    local Y = fill.Size.Y.Scale
    
    if input.KeyCode == Enum.KeyCode.Q then
        fill:TweenSize(UDim2.fromScale(X+0.15, Y), 1, "Back", "Out")
        wait(1)
    end
end)

Result:
https://gyazo.com/8bb3ce5f094102acab87f3acc95ca77b

How could I also bring the overlay to its first position?

Thank you!
-Zlurm

1 Like

try fill:TweenSize(UDim2.fromScale(X+0.15, Y), “Out”, “Back”, 1, true)
and replace “back” and “out” with enum.easingDirection and enum.easingStyle
and remove the wait(1) at the end cuz it just would not wait due to that you are using an event instead of a loop

This should workout.

And to bring it to its initial position, do you mean to decrease the size gradually that the player will be required to hit the button really quickly pr else the thing will not activate?

Thanks! It works.

And to bring it to its initial position, do you mean to decrease the size gradually that the player will be required to hit the button really quickly pr else the thing will not activate?

If the frame decreases the size back to 0, then the player would fail. So yeah, they have to hit the button really quickly.

basically to have a number value.
Have the number to be the X scale of the UI which is being updated every frame.
And after the player first clicks, start a loop that decreases the number.
And when the player clicks, just add values in a loop into the number variable which makes this tween effect.
It sorts of look like this:

local VARIABLE = 0
game["Run Service"]:BindToRenderStepped("Decrease_The_UI_X_Size", 1, function()
    fill.Size = Udim2.new(VARIABLE,0,1,0) 
    VARIABLE = VARIABLE - 1/100
)

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Q then
        for i = 1,10 do
            VARIABLE = VARIABLE + (10-i)/100
            game["Run Service"].RenderStepped:Wait()
        end
    end

end)

yeh, something like this.