|
| 31 Jul 2014 12:59 PM |
So, it's a "Profile search" bar. I have "files" stored in ServerStorage in personal server, so how would I add a bar so that if there are users named: -Distortional -Divergent -Disectable and I'm looking to go to "Distortional"'s profile, so if I type in Di I want it to be able to print("") the First six profiles that start with Di in alphabetical order that are found in ServerStorage.
wait(3) script.Parent.Search.TextBox.Changed:connect(function(property) --WHAT WOULD I ADD HERE TO DO THIS? --WHAT WOULD I ADD HERE TO DO THIS? end)
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 01:06 PM |
1
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Jul 2014 02:12 PM |
I'm feeling up to the challenge :P
for i,v in pairs(--Table name goes here) do if string.find(v,property) then print(v) end |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 02:12 PM |
| BTW, this is the first time I've worked with strings so :P |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 02:15 PM |
| I don't know if thatll work. I will try when I get back on my pc. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 06:39 PM |
Didn't work.
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 06:47 PM |
3
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
Enflare
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 18522 |
|
|
| 31 Jul 2014 06:53 PM |
ugh ik how to do it but I'm on my phone..
I'll reply tomorrow if you still need help. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 06:55 PM |
I still need help. :(
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 06:56 PM |
Assuming you have a loop in place already, if string.find(TextBox.Text,"Di") then --More Code Here end
If that's what you wanted. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 07:02 PM |
I modified it to this, because players will be able to input any text, and it will find the first six. if string.find(game.ServerStorage,""..script.Parent.Search.TextBox.Text) then
20:01:31.022 - Players.Player1.PlayerGui.ScreenGui.Script:40: bad argument #1 to 'find' (string expected, got userdata) 20:01:31.022 - Script 'Players.Player1.PlayerGui.ScreenGui.Script', Line 40 20:01:31.023 - Stack End 20:01:31.023 - Disconnected event because of exception
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 07:06 PM |
4
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 07:18 PM |
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 07:22 PM |
6
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 31 Jul 2014 07:26 PM |
try this:
script.Parent.Search.TextBox.Changed:connect(function(property) lenn = string.len(script.Parent.Search.Text) storage = game.ServerStorage found = storage:findFirstChild(string.sub(script.Parent.Search.Text,1len)) print(found) end) |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 31 Jul 2014 07:26 PM |
opps replace found with this:
found = storage:findFirstChild(string.sub(script.Parent.Search.Text,1,len)) |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 07:33 PM |
@Al, I have it at this now: wait(3) script.Parent.Search.TextBox.Changed:connect(function(property) lenn = string.len(script.Parent.Search.TextBox.Text) storage = game.ServerStorage found = storage:findFirstChild(string.sub(script.Parent.Search.TextBox.Text,1,len)) print(found)
end) end)
and it printed nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 07:35 PM |
Okay, now it finds Player1 once I create the file and I put in the whole name. Anyway I could do it when it finds half the name?
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 09:34 PM |
bump
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 09:54 PM |
again, bump.
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 31 Jul 2014 09:55 PM |
| oh, sorry, Ill fix this, brb |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2014 09:58 PM |
mk, ty
Caaaactus. Prov 3:5: Trust in the LORD with all your heart and lean not on your own understanding. |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 31 Jul 2014 10:01 PM |
put this inside your function
search = script.Parent.Search.TextBox.Text lenn = string.len(search) storage = game.Workspace for i,v in pairs(storage:getChildren()) do lenn2 = string.len(v.Name) for i = 1,lenn2 do txt = string.sub(v.Name,1,i) if txt == search then print("Found: "..v.Name) end end end |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
| |
|