|
| 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 |
|
|
|
| 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 |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 05 Jul 2017 01:40 PM |
| Paying 250 robux before tax for a solution... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
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 |
|
|
|
| 05 Jul 2017 08:01 PM |
Yes captain.
The variables are declared since I use them in other functions aswell. |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jul 2017 08:31 AM |
| Would be a possibility but I would prefer that way. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 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 |
|
|