Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this "Secret Code" GUI script not working properly?

I've been having problems with a GUI that's pretty simple. All it does is once someone enters in the correct code into the input, the script prints Success. If they do not enter the proper code the input box is set to say invalid. Neither parts of the script are working and I cannot figure out why. I'm getting no errors in output or in the script. What's wrong with it?

script.Parent.MouseButton1Click:connect(function()
	if script.Parent.Parent.Input.Text == "Code" then
     print("Success")

    else
	   script.Parent.Parent.Input.Text = 'Invaild'
	end
	end)

Edit: This is a local script and everything is in starter GUI. I can see the GUI and input text but nothing happens even if the code is correct or incorrect.

5 comments

0

Post more information. Is it a LocalScript?

0

Have you tried using a breakpoint to see what it's doing?

0

No, I'll try that.

0

so is the code just 'Code' or something else? (like numbers)

0

Is the LocalScript a child of the button? I've had issues in the past with .Text not returning any values. Although yours is just not working. Check to make sure your script isn't disabled.

1 answer

I had the same problem, the thing I did was replacing "" 's with '' 's. And also consider using :Connect() as :connect() is deprecated

script.Parent.MouseButton1Click:Connect(ffunction()
    if script.Parent.Parent.Input.Text == 'Code' then
     print("Success")

    else
       script.Parent.Parent.Input.Text = 'Invaild'
    end
end)

3 comments

0

Still having issues with it. Is there anything else I could try?

0

Changing from double quotes to single quotes did NOT help.

0

I think you meant to say function (not ffunction)

This discussion is preserved as it was. New answers, comments, and votes are closed.