generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: HOW WOULD I DO THIS?

Previous Thread :: Next Thread 
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
31 Jul 2014 02:07 PM
2
Report Abuse
ObsessedwithMario is not online. ObsessedwithMario
Joined: 03 Mar 2012
Total Posts: 268
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
ObsessedwithMario is not online. ObsessedwithMario
Joined: 03 Mar 2012
Total Posts: 268
31 Jul 2014 02:12 PM
BTW, this is the first time I've worked with strings so :P
Report Abuse
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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 is not online. 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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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 is not online. 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 is not online. 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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
31 Jul 2014 09:55 PM
oh, sorry, Ill fix this, brb
Report Abuse
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
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 is not online. 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 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
31 Jul 2014 10:09 PM
Im a genius c:
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image