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

How to script. When code wrong = show gui and hide in slide animation?

Asked by 4 years ago

Hello. I do not know anything about scripts, so please help me. How can I write that if I enter the wrong password, another gui from (animation) UDim2.new shows and hides after a few seconds? This is my script:

local TextBox = script.Parent
TextBox.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLost)
    if enterPressed then
        if script.Parent.Parent.TextBox.Text == "ok" then
            script.Parent.Parent.Parent.Login.Visible = true
            script.Parent.Parent.Parent.Wrongpasswordtryagain.Visible = true
            wait(5)
            script.Parent.Parent.Parent.Wrongpasswordtryagain.Visible = false
        end
    end
end)

And should i gui animation put here?

0
Wait, you do now know anything about scripts? Anything at all? I suggest watching some tutorials. ElongatedMongoose 138 — 4y
0
I know a little bit, but not much, so I am asking for help. cutexolaa 2 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

move the THEUIOBJECTHATWILLAPPEAR to a position not visible to the player.

game:GetService("UserInputService").InputBegan:Connect(function(InputObject)
    if ORIGINALUIOJBECT.Visible then
        if InputObject.Key == Enum.KeyCode.Enter then
            coroutine.resume(coroutine.create(function()
                ORIGINALUIOJBECT.Visible = false
                THEUIOBJECTHATWILLAPPEAR:TweenPosition(UDim2.new(POSITION))
           wait(5)THEUIOBJECTHATWILLAPPEAR:TweenPosition(UDim2.new(THEUIORIGINALPOSITION))
            end))
        end
    end
end)

Ad
Log in to vote
0
Answered by 4 years ago

I am not very sure what you want but this is what I think the answer is

local TextBox = script.Parent
    TextBox.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLost)
    if enterPressed then
        if script.Parent.Parent.TextBox.Text == "ok" then
            script.Parent.Parent.Parent.Login.Visible = true
            script.Parent.Parent.Parent.Wrongpasswordtryagain.Visible = false
        else
            script.Parent.Parent.Parent.Wrongpasswordtryagain.Visible = true
            script.Parent.Parent.Parent.Login.Visible = false


Answer this question