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

i have a problem with my verify script?

so basically im trying to do that when you click a button and the text in a textbox says 13 then something appears

script:

script.Parent.MouseButton1Down:Connect(function()
	if script.Parent.Parent.TextBox.Text = "13" then
		game.Workspace.Maxwellforbooks.maxwell.Transparency = 0
		game.Workspace.Maxwellforbooks.forgor.Transparency = 0.02
	end
end)

i also tryied to put == in line 2 but this didnt worked

it also cannot be a problem with the type of scripts because the local and the normal script didnt worked

5 comments

0

there's nothing wrong except line 2, line 2 should have two equal signs

0

if that didn't work, you probably did something wrong other than this script

0

sorry if you got spam notifications, the site crashed for 2 seconds and it made my comment repeat 10 times

0

as i said == dont work

0

then your text is != 13

2 answers

Are you running this on a server script or a local script? If on server, it won't work, because client doesn't replicate on server, meaning that the TextBox.Text variable is always nil for server.

If this is the problem, put the code in a local script.

Otherwise, if you want the player to only write numbers in the TextBox, here's the script:

local pattern = "^%d+$"

script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Parent.TextBox.Text:match(pattern) and script.Parent.Parent.TextBox.Text == "13" then -- make sure the text has no spaces and is only numbers from start to end
        game.Workspace.Maxwellforbooks.maxwell.Transparency = 0
        game.Workspace.Maxwellforbooks.forgor.Transparency = 0.02
    else
	script.Parent.Parent.TextBox.Text = "Invalid number"
    end
end)

Also, to make sure your script has no errors, check the output. You can use the script I provided above, it works for me. (make sure Maxwell the cat is completely invisible otherwise it will just be visible before you write 13)

I think that you need to change:

script.Parent.MouseButton1Down:Connect(function()

to:

script.Parent.MouseButton1Click:Connect(function()

Hope it works :)

4 comments

0

That's literally almost the same thing, MouseButton1Click is the combination of MouseButton1Down and MouseButton1Up

0

Oh sorry, I tested the code and I don't know if you forgot to put 13 on the textbox when you're playing the game... don't you?

0

no actually you need to type 13 in the text box and after that it makes it appear

0

Don't tell that you're clicking the button an then putting 13 on the text box....

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