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 1 year ago
Edited 1 year 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:

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

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

2 answers

Log in to vote
0
Answered by 1 year 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:

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)

Ad
Log in to vote
-1
Answered by 1 year ago

I think that you need to change:

script.Parent.MouseButton1Down:Connect(function()

to:

script.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 — 1y
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 — 1y
0
no actually you need to type 13 in the text box and after that it makes it appear guardian_stone 12 — 1y
0
Don't tell that you're clicking the button an then putting 13 on the text box.... Hgamerpro50 0 — 1y

Answer this question