Hi, I wanted to make a Passcode GUI for my Place. Everything works but when I enter the password and press the enter key, It wont tell that the password is right or and It wont close the GUI if the password is correct. Heres the script so you can see what mistakes i have done. The script is placed in the StarterPack and the script is a LocalScript.
code = "EnterCodeHere"
---------------------------------!WARNING!---------------------------------------------
---DON'T CHANGE ANYTHING!---
Player = script.Parent.Parent
Mouse = Player:GetMouse()
codegui = script.Parent.Parent.StarterGui.CodeGUI
codeteller = script.Parent.Parent.StarterGui.CodeGUI.Background.PasscodeTeller
codetype = script.Parent.Parent.StarterGui.CodeGUI.Passcode.TypeCodeHere
function onKeyDown()
local key = key.lower()
if key:byte() == 13 then -- From this part it stops working...
if (codetype == code) then
codeteller.Text = "Correct"
wait(2)
script.Parent.Parent.Character.Humanoid.WalkSpeed = 16
codegui:remove()
else
codeteller.Text = "Wrong"
wait(3)
codeteller.Text = "Passcode"
end
end
end
Mouse.KeyDown:connect(onKeyDown)
Thanks! -Chillu4

6 comments
Are you getting any errors in Output?
Sorry for the late reply, There is the picture of the OutPut: http://prntscr.com/6199lk
The script above is in a LocalScript named "LocalScript" and It is placed in the StarterPack. There is another script inside the GUI which only makes the GUI visible and makes the Player's walkspeed to 0
Is the "Code Gui" object named "CodeGUI", no space, or "Code GUI" with the space?
No space.
I don't know why that's erroring then. If your gui is named "CodeGUI" and not "Code GUI", this should be working.