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

Why doesnt my adminlocker GUI work? When I input the password, nothing happens!

Asked by 6 years ago

I recently got an admin menu GUI that shows up on every player's screen and it is not compatible with my last GUI Locker, so I made a new one, and it doesnt seem to work. I made it in a really weird way which I will explain.

this is where everything is located ::

workspace>StarterGui>AdminLock>TextBox>Script

This is the script that is in Script ::

if script.Parent.Text == ("112Aa3C") then script.Parent.Visible = false end

I tried to make it as simple as possible so I didn't have to to a bunch of work, but essentially what is is doing, is there is supposed to be a textbox over the admin GUI buttons, and when you input the proper text, the script detects that and sets the TextBox's Visibility to ~nil

The issue is, nothing is happening. I wasnt sure if I was supposed to use a localscript or what, but I couldn't figure it out. I can put the text in but the script is not detecting the input.

2 answers

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

StarterGui>ScreenGui>AdminLock>TextBox>LocalScript

Any coding GUI related MUST be a Local Script.

local textbox = script.Parent

textbox:GetPropertyChangedSignal('Text'):Connect(function()
    if textbox.Text == "112Aa3C" then -- No brackets! '()'
        textbox.Parent.Visible = false
    end
end)
0
Didn't even know getpropertychangedsignal was a thing stepatron 103 — 6y
Ad
Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

I created this simple script just for testing, but it is what you are looking for, and will solve your problem.

--Create a localscript, put this script in it, and put the script in your TextBox
local code = "InsertCodeHere" -- This is what you want the user to enter.
script.Parent.FocusLost:Connect(function (property)
    if script.Parent.Text == code then
        local part1 = Instance.new("Part",game.Workspace)
        part1.Anchored = true
    else
        script.Parent.Text = "Code not accepted."
        end
end)

Basically what this script does, is waits for the TextBox to lose focus (Pressing enter, clicking away, etc). Once focus is lost, it will determine weather or not TextBox.Text = code. If so, then create a part (or in your case, make invisible or whatever), if not, then it makes the TextBox say "Code not accepted." so players know it wasn't accepted.

The problem with your script is there was no way for it to even detect if the text value changed. so for you the script would be similar to this

local code = "InsertCodeHere" -- This is what you want the user to enter.
script.Parent.FocusLost:Connect(function (property)
    if script.Parent.Text == code then
script.Parent.Visible = false
    else
        script.Parent.Text = "Code not accepted."
        end
end)

EDIT: Seems incapaz beat me too it. His script with "textbox:GetPropertyChangedSignal('Text'):Connect(function()" would actually be better, as it will only detect if the text value was changed. Use his for a better solution.

0
Horrible code. The asker is quite inexperienced, and giving him deprecated code isn’t helping. You disgust me. User#19524 175 — 6y
0
Im quite inexperienced as well, but was confident in my code. I even stated that your code was infact better, and to use it instead. Saying I disgust you is just immature, and not necessary. You could instead of directed me to a better solution, and explain how my code is deprecated. WizyTheNinja 834 — 6y
1
:Connect, not :connect. User#19524 175 — 6y
0
Ah yes. I actually didn't realize I used :connect. Simple typo. But thanks for noticing. WizyTheNinja 834 — 6y
View all comments (5 more)
0
I like your code too, but improper spelling / using deprecated code can cause problems. Sorry if I went too far.. User#19524 175 — 6y
0
You are fine. I actually am aware of :Connect, but did this code in a hurry and forgot to capatalize it. However yes, using deprecated code will mess stuff up, and I apologize for it. However I did correct my post with :Connect. And you did not take it too far, however it could have been approached differently. Were all here to assist eachother, even if we didn't ask haha. WizyTheNinja 834 — 6y
0
heh yea User#19524 175 — 6y
0
One of my big issues tho is that I try to use really simple code and make it work, and im still working on the basics of LUA, im learning C# at the same time which doesnt help me remember lol, but thx curtisman333 2 — 6y
0
It’s not LUA, it’s Lua. User#19524 175 — 6y

Answer this question