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

i have a problem with my verify script?

Asked by 2 years ago
Edited 2 years ago

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

script:

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

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

0
there's nothing wrong except line 2, line 2 should have two equal signs T3_MasterGamer 2189 — 2y
0
if that didn't work, you probably did something wrong other than this script T3_MasterGamer 2189 — 2y
0
sorry if you got spam notifications, the site crashed for 2 seconds and it made my comment repeat 10 times T3_MasterGamer 2189 — 2y
0
as i said == dont work guardian_stone 12 — 2y
0
then your text is != 13 xXLegendGamerz16Xx 231 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago

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:

01local pattern = "^%d+$"
02 
03script.Parent.MouseButton1Click:Connect(function()
04    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
05        game.Workspace.Maxwellforbooks.maxwell.Transparency = 0
06        game.Workspace.Maxwellforbooks.forgor.Transparency = 0.02
07    else
08    script.Parent.Parent.TextBox.Text = "Invalid number"
09    end
10end)

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)

Ad
Log in to vote
-1
Answered by 2 years ago

I think that you need to change:

1script.Parent.MouseButton1Down:Connect(function()

to:

1script.Parent.MouseButton1Click:Connect(function()

Hope it works :)

0
That's literally almost the same thing, MouseButton1Click is the combination of MouseButton1Down and MouseButton1Up T3_MasterGamer 2189 — 2y
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? Hgamerpro50 0 — 2y
0
no actually you need to type 13 in the text box and after that it makes it appear guardian_stone 12 — 2y
0
Don't tell that you're clicking the button an then putting 13 on the text box.... Hgamerpro50 0 — 2y

Answer this question