Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. local RemoteFunction = script.Parent
  2.  
  3. function RemoteFunction.OnServerInvoke(Player, Searched)
  4. local GetRating = script.Parent.Parent:WaitForChild("GetRating")
  5. local ShopItems = game.ServerStorage:WaitForChild("ShopItems")
  6. local Items = {}
  7. for _, v in pairs(ShopItems:GetChildren()) do
  8. for _, Item in pairs(v:GetChildren()) do
  9. if Searched == nil or Item.Name:lower():find(Searched:lower()) then
  10. local AssetId = Item:FindFirstChild("AssetId")
  11. if AssetId then
  12. AssetId = AssetId and "rbxassetid://"..AssetId.Value or ""
  13. table.insert(Items, {Item.Name, Item.Price.Value, Item.Description.Value, AssetId, v.Name, GetRating:InvokeServer(Item.Name, "Rating") or 0, GetRating:InvokeServer(Item.Name, "Raters") or 0})
  14. end
  15. local IconId = Item:FindFirstChild("Icon")
  16. if IconId then
  17. IconId = IconId and "rbxassetid://"..IconId.Value or ""
  18. table.insert(Items, {Item.Name, Item.Price.Value, Item.Description.Value, IconId, v.Name, GetRating:InvokeServer(Item.Name, "Rating") or 0, GetRating:InvokeServer(Item.Name, "Raters") or 0})
  19. end
  20. end
  21. end
  22. end
  23. table.sort(Items, function(a, b)
  24. return string.lower(a[1]) < string.lower(b[1])
  25. end)
  26. return Items
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement