Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why does the GUI instantly disappear?

Asked by 29 days ago
    if Input.KeyCode == Enum.KeyCode.Q then -- Opening
        script.Parent:TweenPosition(
            UDim2.new(0,0,-1),
            "Out",
            "Quart",
            2,
            false,
            nil
        )
        script.Parent.Visible = false
    end

If you can help, Thanks.

1 answer

Log in to vote
1
Answered by
VAHMPIN 265 Moderation Voter
29 days ago

It instantly disappears as you haven't added any sort of wait or check to see if the tween has finished, try adding a check or wait such as:

if Input.KeyCode == Enum.KeyCode.Q then -- Opening
    script.Parent:TweenPosition(
        UDim2.new(0,0,-1),
        "Out",
        "Quart",
        2,
        false,
        nil
    )
    wait(5) -- not most accurate but you can change the wait time.
    script.Parent.Visible = false
end
0
Thanks! productofdevs 1 — 29d
0
It only needs to wait for 2 seconds because that's the time specified as an argument for the gui to move. sheepposu 546 — 29d
Ad

Answer this question