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

I need help finding a fix for the (probobly) simple mistake?[SOLVED]

Asked by 9 years ago

THIS script is for a passcode Gui that requires you to put the games passcode into the gui to prevent wandering people from looking at my game.

Everything works except the "tries" part of it. What the "tries" part is, is that when a player inputs the wrong code, one is added to the "tries," and when they input 5 incorrect codes, the frame will get deleted, and left with a black screen (the frame that is getting deleted is inside another black frame that covers the whole screen)

tries = 0

function onButton1Down()
local passwordvalue = script.Parent.Parent.Password.Value
if script.Parent.Parent.TextBox.Text == passwordvalue or script.Parent.Parent.TextBox.Text == passwordvalue:lower() or script.Parent.Parent.TextBox.Text == passwordvalue:upper() then
script.Parent.Parent.Right.Visible = true
script.Parent.Parent.Status.Visible = false
wait(1)
script.Parent.Parent.Parent.Visible = false
else script.Parent.Parent.Status.Text = "Wrong Passcode"
    tries =  +1             --this is where im having trouble

    script.Parent.Parent.Status.Visible = true
    wait(0.1)
    script.Parent.Parent.Status.Visible = false
    wait(0.1)
    script.Parent.Parent.Status.Visible = true
    wait(0.1)
    script.Parent.Parent.Status.Visible = false
    wait(0.1)
    script.Parent.Parent.Status.Visible = true
 if tries == 5 then
    script.Parent.Parent.Status.Text = "Incorrect too many times!"
    wait(1)
    script.Parent.Parent.Status.Text = "You are locked out!"
    wait(1)
    script.Parent.Parent.Status.Text = "Incorrect to many times!"
    wait(1)
    script.Parent.Parent.Status.Text = "You are locked out!"
    wait(1)
    script.Parent.Parent:Destroy()
end

end
end

script.Parent.MouseButton1Down:connect(onButton1Down)

Sorry if this is too confusing...

1
try using "tries = tries + 1" instead Necrorave 560 — 9y
0
Thanks necro. You should have made an answer so i could give you more rep. My_Comment 95 — 9y
1
No problem. I wasn't sure if it would fix everything, so I figured a comment would be enough for a simple mistake. Good luck though! Necrorave 560 — 9y
0
Thanks! My_Comment 95 — 9y
0
This is a better way to script and shorten line 5. [if script.Parent.Parent.TextBox.Text:lower() == password.value:lower() then] Also, I recommend using for loops for your flashing text. GoldenPhysics 474 — 9y

Answer this question