so basically im trying to do that when you click a button and the text in a textbox says 13 then something appears
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
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:
Hope it works :)