Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How i pause the Tweening?

Asked by 5 years ago

In the Script, with you hold E, a Power Bar start to fill, but i don't know how to Pause the Tweening when the Player stops hold E.

Script:

Ok = false

function SubirForca(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then
        Ok = true
        if Ok == true then
            script.Parent.Forca:TweenSize(UDim2.new(0, 200, 0, 20), "Out", "Linear")
            print("Subindo barra de força")
        end
    end
end

game:GetService("UserInputService").InputBegan:connect(SubirForca)

function ManterForca()
    Ok = false
    print("Força mantida")
end

game:GetService("UserInputService").InputEnded:connect(ManterForca)

2 answers

Log in to vote
0
Answered by
chomboghai 2044 Moderation Voter Community Moderator
5 years ago

Use TweenService to create a new Tween instance, which can then be Pause()d.

0
I believe he's using a GuiObject. User#22219 20 — 5y
0
You can still use TweenService. chomboghai 2044 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Don't think you can unless you use some knowledge like:

if Ok == false then
    script.Parent:TweenSize(UDim2.new(0, 0, 0, 0), "InOut", "Linear", .5)
end

For more info, read: http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenSize

Answer this question