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 » Scripters
Home Search
 

Re: Custom sort function doesn't work on normal play

Previous Thread :: Next Thread 
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 06:50 AM
Hey,
so I've set a custom sort function. >It works perfectly fine in Roblox Studio.<
On a mouseclick on a button this gets executed:

local function doHighToLow()
setSortOrder(Enum.SortOrder.Custom)
UIGridLayout:SetCustomSortFunction(sortHighToLow)
UIGridLayout:ApplyLayout()
end

The function sortHighToLow is this:

local function sortHighToLow(a, b)
if a ~= b then
if isInInv(a.Name).Price.Value < isInInv(b.Name).Price.Value then
print(isInInv(a.Name), isInInv(b.Name))
return false
else
return true
end
else
return false
end
end

The function isInInv returns objects and it works so far. Those also contain a Price IntValue.

This crashes the game. I sometimes also get this an error which I didn't capture but it the error itself is in Lua MergeSort, which is a roblox built in script.

Any help is appreciated.
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 06:51 AM
The last sentence was meant to be:
This crashes the game. I sometimes get an error which I didn't capture but it said that it is in "Lua MergeSort". It has no reference to my script anywhere.
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 10:07 AM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 10:51 AM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 11:29 AM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 12:00 PM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 12:31 PM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 01:03 PM
Bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 01:40 PM
Paying 250 robux before tax for a solution...
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 02:16 PM
Bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 04:59 PM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 06:09 PM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 07:32 PM
bump
Report Abuse
ParaText is not online. ParaText
Joined: 15 Aug 2016
Total Posts: 799
05 Jul 2017 07:37 PM
Are you sure you're using the :WaitForChild() method in your client code?


Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
05 Jul 2017 08:01 PM
Yes captain.

The variables are declared since I use them in other functions aswell.
Report Abuse
ForceCyber is not online. ForceCyber
Joined: 06 May 2015
Total Posts: 1086
05 Jul 2017 11:09 PM
table.sort?
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
06 Jul 2017 08:31 AM
Would be a possibility but I would prefer that way.
Report Abuse
SilverS0ul is not online. SilverS0ul
Joined: 09 Jun 2015
Total Posts: 269
06 Jul 2017 09:37 AM
bump
Report Abuse
maxi123456 is not online. maxi123456
Joined: 10 Apr 2009
Total Posts: 148
06 Jul 2017 01:03 PM
bump
Report Abuse
MingHin0000 is not online. MingHin0000
Joined: 08 Sep 2016
Total Posts: 1
09 Jul 2017 04:18 AM
I have the same problem too! Below is my script.

local layout = script.Parent.Shop.Holder.UIGridLayout
layout.SortOrder = Enum.SortOrder.Custom
layout:SetCustomSortFunction(function(x,y)
return game.ReplicatedStorage.items[x.Name].Cost.Value game.ReplicatedStorage.items[y.Name].Cost.Value
end)
layout:ApplyLayout()

Completely same problem mentioned as above.

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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