|
| 01 May 2013 07:30 AM |
I've been pondering this for a while, but now I'm stuck on my project because I do not know how this would work. I'm making a login for a GUI computer, how can I make a script look for an account with the same name as the Username box's text? I can make the protector comparison myself, but the first bit, well, I have no idea... |
|
|
| Report Abuse |
|
|
1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
|
| 01 May 2013 07:34 AM |
local Accounts = {["JimBob"] = '1234567']}
function CheckAccounts(Username,pw) for i,v in pairs(Accounts) do if i == Username.Text and v == pw.Text then return true end end return false end |
|
|
| Report Abuse |
|
|
|
| 01 May 2013 07:40 AM |
| In my system, it allows you to create new accounts, so a table can't work. Sorry I didn't say that before. |
|
|
| Report Abuse |
|
|
1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
|
| 01 May 2013 07:42 AM |
@Delor,
Couldn't you do something like this?
(If there is no other account with said name, then:)
Accounts[NEWACCOUNT.Text] = NEWPW.Text
?? |
|
|
| Report Abuse |
|
|
|
| 01 May 2013 02:09 PM |
| I was thinking of using FindFirstChild... but I don't know how to use it yet, and the wiki's bad at teaching some of these things... |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 01 May 2013 02:24 PM |
@Del, You can use a table. You'd do something alike what WOOF has displayed in his second post. |
|
|
| Report Abuse |
|
|
|
| 01 May 2013 02:30 PM |
@Desperian It lets you make new accounts, so... Anyway, nevermind. I got it working. Here's my code, if you're interested:
script.Parent.MouseButton1Click:connect(function() tag1 = script.Parent.Parent.User.Text tag2 = script.Parent.Parent.Pass.Text found = script.Parent.Parent.Parent.Parent:FindFirstChild(tag1) if found then if found.Config.Protector.Value == tag2 then found.Visible = true script.Parent.Parent.parent.Visible = false script.Parent.Parent.Alert.Text = " " else script.Parent.Parent.Alert.Text = "Your protector is incorrect." end else script.Parent.Parent.Alert.Text = "Your username cannot be found." end end)
You all know what "Protector" means. |
|
|
| Report Abuse |
|
|
|
| 01 May 2013 02:33 PM |
Dang. Now my other script is having a problem. It's supposed to finalize accounts based off values it set earlier, anyone see errors here?
script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Visible = false wait(1.0) script.Parent.Parent.Parent.Visible = false script.Parent.Parent.Parent.One.Visible = true script.Parent.Parent.Parent.Parent.Login.Visible = true script.Parent.Parent.Parent.Parent.New.Config.Protector= script.Parent.Parent.Parent.Parent.Parent.Config.New2.Protector.Value script.Parent.Parent.Parent.Parent.New.Name = script.Parent.Parent.Parent.Parent.Parent.Config.New2.Uname.Value end)
|
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 01 May 2013 02:54 PM |
names = {"getkoed2"} codes = {"test123"}
function checkName(thing) for i = 1, #names do if names[i]:lower() == thing:lower() then return i end end return false end
function checkCode(thing, num) if codes[num] == thing then return true end return false end
script.Parent.MouseButton1Down:connect(function() local cN = checkName(script.Parent.Parent.Name.Text) if cN then if checkCode(script.Parent.Parent.Code.Text, cN) then print("Access granted!") else print("Code incorrect!") end else print("Name doesn't exist!") end end)
-- Put this script in e.g. a submit button. Put a TextBox called Name and a TextBox called Code in the submit's parent. Voila. -- Tables work fine. You can make a page with sign in stuff, and if they click submit, a value will be added to both tables (using table.insert). |
|
|
| Report Abuse |
|
|
|
| 02 May 2013 07:24 AM |
| My problems are solved already. Nevermind, guys. It's working. |
|
|
| Report Abuse |
|
|