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 » Club Houses » Let's Make a Deal
Home Search
 

Re: lmad scripters please help

Previous Thread :: Next Thread 
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 07:12 AM
local sortdis = {}

for i,v in pairs(workspace.Model:GetChildren()) do
table.insert(sortdis,v = v.Value)
end

--table.sort(sortdis)

--print(unpack(sortdis))


the table.insert(sortdis,v = v.Value) won't work

what i want to do is have a table of intvalues

and i wan't it to order it from least to greatest based on the intvalues Value



[ btw 4 anyone who is waiting on limited simulator, this is for the private selling feature that im adding, all i need is to finish this part & then it'll be done ]
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 07:14 AM
swasdas
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 07:21 AM
ccccccc
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 07:27 AM
kikjnnnjnm
Report Abuse
SparkIeFarts is not online. SparkIeFarts
Joined: 27 Sep 2008
Total Posts: 16166
11 Dec 2014 07:29 AM
Get rid of the v ='v.Value

and just put v?
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 02:27 PM
but then table.sort wouldnt work cause it'd be sorting a table of IntValues

i want it to sort them based on their Values
Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
11 Dec 2014 02:28 PM
lemme help
Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
11 Dec 2014 02:30 PM
You don't have to use int values but mmk, also' v= ' part is not going to work.
I'll post rescripted version in a sec.
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
11 Dec 2014 02:31 PM
If youre wanting to sort a table, lets say from smallest to largest, and you are sorting actual values, then table.sort wont work im pretty sure.

Look at this:

http://wiki.roblox.com/index.php?title=Category:Sorting_algorithms


This gives you 3 examples to fix your problem.
Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
11 Dec 2014 02:32 PM
You cannot get value from stuff in the player that does not have value properties..
etc Parts..
if v.ClassName == "IntValue" then

end
Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
11 Dec 2014 02:34 PM
for i,v in pairs(workspace.Model:GetChildren()) do
if v.ClassName == "IntValue" then
table.insert(sortdis, v.Value)
end

end
Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
11 Dec 2014 02:35 PM
Just print the values in the table for a double check, now for that least to greatest thing.
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 02:37 PM
hex, my goal is to have a table of IntValues, not the Values of them


& then after that, i need a way to sort all the IntValues from least to greatest

based on the Value of them
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
11 Dec 2014 02:37 PM
*cough* My post *cough*
Report Abuse
ZacAttackk is not online. ZacAttackk
Joined: 23 Mar 2010
Total Posts: 15481
11 Dec 2014 02:38 PM
I don't think you can store Userdata, so store the name of the value instead or copy the values into a list inside the script for later use.
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 02:42 PM
@footba11 everything there confused me lol

Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
11 Dec 2014 02:43 PM
You can't store userdata , not that I know of.
But you could store the values in the table and save them.
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
11 Dec 2014 02:45 PM
i found it, cntkillme helped



local sortdis = {}

for i,v in pairs(workspace.Model:GetChildren()) do
table.insert(sortdis,v)
end

table.sort(sortdis, function(a, b) return a.Value < b.Value; end);
Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
11 Dec 2014 02:46 PM
like?
local szz= {v.Value}

?
Report Abuse
FootBa11 is not online. FootBa11
Joined: 16 Sep 2008
Total Posts: 11501
11 Dec 2014 02:47 PM
Fine.

Ill just write it out for you


repeat
swapped = false
for i=2, #sortdis do
if sortdis[i-1].Value > sortdis[i].Value then
sortdis[i-1].Value, sortdis[i].Value = sortdis[i].Value, sortdis[i-1].Value
swapped = true
end
end
until not swapped


This sorts your values in your table from Greatest to least.
Where your greates value is sortdis[1] and your smallest value is sortdis[#sortdis]
Report Abuse
TheSecondPower is not online. TheSecondPower
Joined: 15 Mar 2013
Total Posts: 15726
11 Dec 2014 02:47 PM
ogm so its almot done?!?!


R$62,816 on hand! Current RAP 1,268,112
Report Abuse
TheSecondPower is not online. TheSecondPower
Joined: 15 Mar 2013
Total Posts: 15726
11 Dec 2014 03:10 PM
Make sure u make the inventory save and stuff!!


R$62,831 on hand! Current RAP 1,268,112
Report Abuse
happyblockhead is not online. happyblockhead
Joined: 20 Jan 2010
Total Posts: 14620
11 Dec 2014 03:11 PM
did u try wumbo?
Report Abuse
SparkIeFarts is not online. SparkIeFarts
Joined: 27 Sep 2008
Total Posts: 16166
11 Dec 2014 04:59 PM
Told ya to remove the v=value crap! >:(

Just didn't inownto add the extra bit at the end...
NOOB!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Club Houses » Let's Make a Deal
   
 
   
  • 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