Advertisement
Gerard_games

Trade to script

Oct 2nd, 2021 (edited)
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. local Library = require(game:GetService("ReplicatedStorage").Framework.Library)
  2. workspace.__THINGS.__REMOTES.MAIN:FireServer("b", "add trade pet")
  3. wait(0.25)
  4. function GetPetThing(idthing)
  5. local Type = string.sub(idthing, -1)
  6. local id = idthing:sub(1, -3)
  7. local Lookfor = (Type == "4" and "dm") or (Type == "3" and "r") or (Type == "2" and "g") or (Type == "1" and nil)
  8. for i, v in pairs(Library.Save.Get().Pets) do
  9. if Lookfor ~= nil then
  10. if v.id == id and v[Lookfor] then
  11. return v.uid
  12. end
  13. elseif v.id == id and not v['dm'] and not v['r'] and not v['g'] then
  14. return v.uid
  15. end
  16. end
  17. end
  18.  
  19. _G.TradeIDThing = ""
  20. spawn(function()
  21. repeat wait() until _G.TradeIDThing ~= ""
  22. local added = 0
  23. for i, v in pairs(_G.TableOfPets) do
  24. if added < _G.EmptySlots then
  25. spawn(function()
  26. workspace.__THINGS.__REMOTES["add trade pet"]:InvokeServer({_G.TradeIDThing, GetPetThing(v)})
  27. end)
  28. added = added + 1
  29. end
  30. end
  31. end)
  32.  
  33. local mt = getrawmetatable(game)
  34. local oldnamecall = mt.__namecall
  35. setreadonly(mt, false)
  36.  
  37. mt.__namecall = newcclosure(function(self, ...)
  38. local args = {...}
  39. if _G.TradeIDThing == "" and self == workspace.__THINGS.__REMOTES["get trade"] and getnamecallmethod() == "InvokeServer" then
  40. _G.TradeIDThing = args[1][1] or ""
  41. end
  42. return oldnamecall(self, ...)
  43. end)
  44.  
  45. setreadonly(mt, true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement