-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPSX SCRIPT.lua
2547 lines (2062 loc) · 76.8 KB
/
PSX SCRIPT.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
-- THIS SCRIPT HAS BEEN CODED BY RY (dsc.gg/rans)
-- DON'T BE A STUPID SKIDDIE THAT STEAL PEOPLE CODE AND PUT ON A SHIT PAID (or "watch ad to get key") SCRIPT
-- hi Project WD please don't steal my code again thx
-- For Preston:
-- Sorry for any incovenience I don't make any malicous script like mail/bank stealers, trade scam and this shit, just auto-farm and QoL scripts, feel free to use this repo to fix any vulnerability on your game
--]]
-- Join us at
-- https://dsc.gg/rans
--[[
-- TODO LIST:
-- • Huge notifier on Discord Webhook (its ez but I'm lazy)
-- • Auto quest
-- • Improve Bank Index with "Auto buy storage upgrades" (+ withdraw needed diamonds from bank)
--]]
-- Important Variables
local SCRIPT_NAME = "Ry PSX GUI"
local SCRIPT_VERSION = "v0.1" -- Hey rafa remember to change it before updating lmao
-- Detect if the script has executed by AutoExec
local AutoExecuted = false
if not game:IsLoaded() then AutoExecuted = true end
repeat task.wait() until game.PlaceId ~= nil
if not game:IsLoaded() then game.Loaded:Wait() end
--//-------------- SERVICES ----------------//*
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local HttpService = game:GetService("HttpService")
local InputService = game:GetService('UserInputService')
local RunService = game:GetService('RunService')
local ContentProvider = game:GetService("ContentProvider")
--//*--------- GLOBAL VARIABLES -----------//*
local ScriptIsCurrentlyBusy = false
local Character = nil
local Humanoid = nil
local HumanoidRootPart = nil
local CurrentWorld = ""
local CurrentPosition = nil
local Settings_DisableRendering = true
local Webhook_Enabled = false
local Webhook_URL = ""
local Webhook_Daycare = true
local Webhook_Huge = true
LocalPlayer.CharacterAdded:Connect(function(char)
Character = char
Humanoid = Character:WaitForChild("Humanoid")
HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
end)
if game.PlaceId == 6284583030 or game.PlaceId == 10321372166 or game.PlaceId == 7722306047 or game.PlaceId == 12610002282 then
local banSuccess, banError = pcall(function()
local Blunder = require(game:GetService("ReplicatedStorage"):WaitForChild("X", 10):WaitForChild("Blunder", 10):WaitForChild("BlunderList", 10))
if not Blunder or not Blunder.getAndClear then LocalPlayer:Kick("Error while bypassing the anti-cheat! (Didn't find blunder)") end
local OldGet = Blunder.getAndClear
setreadonly(Blunder, false)
local function OutputData(Message)
print("-- PET SIM X BLUNDER --")
print(Message .. "\n")
end
Blunder.getAndClear = function(...)
local Packet = ...
for i,v in next, Packet.list do
if v.message ~= "PING" then
OutputData(v.message)
table.remove(Packet.list, i)
end
end
return OldGet(Packet)
end
setreadonly(Blunder, true)
end)
if not banSuccess then
LocalPlayer:Kick("Error while bypassing the anti-cheat! (".. banError ..")")
return
end
local Library = require(game:GetService("ReplicatedStorage").Library)
assert(Library, "Oopps! Library has not been loaded. Maybe try re-joining?")
while not Library.Loaded do task.wait() end
Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
Humanoid = Character:WaitForChild("Humanoid")
HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local bypassSuccess, bypassError = pcall(function()
if not Library.Network then
LocalPlayer:Kick("Network not found, can't bypass!")
end
if not Library.Network.Invoke or not Library.Network.Fire then
LocalPlayer:Kick("Network Invoke/Fire was not found! Failed to bypass!")
end
hookfunction(debug.getupvalue(Library.Network.Invoke, 1), function(...) return true end)
-- Currently we don't need to hook Fire, since both Invoke/Fire have the same upvalue, this may change in future.
-- hookfunction(debug.getupvalue(Library.Network.Fire, 1), function(...) return true end)
local originalPlay = Library.Audio.Play
Library.Audio.Play = function(...)
if checkcaller() then
local audioId, parent, pitch, volume, maxDistance, group, looped, timePosition = unpack({ ... })
if type(audioId) == "table" then
audioId = audioId[Random.new():NextInteger(1, #audioId)]
end
if not parent then
warn("Parent cannot be nil", debug.traceback())
return nil
end
if audioId == 0 then return nil end
if type(audioId) == "number" or not string.find(audioId, "rbxassetid://", 1, true) then
audioId = "rbxassetid://" .. audioId
end
if pitch and type(pitch) == "table" then
pitch = Random.new():NextNumber(unpack(pitch))
end
if volume and type(volume) == "table" then
volume = Random.new():NextNumber(unpack(volume))
end
if group then
local soundGroup = game.SoundService:FindFirstChild(group) or nil
else
soundGroup = nil
end
if timePosition == nil then
timePosition = 0
else
timePosition = timePosition
end
local isGargabe = false
if not pcall(function() local _ = parent.Parent end) then
local newParent = parent
pcall(function()
newParent = CFrame.new(newParent)
end)
parent = Instance.new("Part")
parent.Anchored = true
parent.CanCollide = false
parent.CFrame = newParent
parent.Size = Vector3.new()
parent.Transparency = 1
parent.Parent = workspace:WaitForChild("__DEBRIS")
isGargabe = true
end
local sound = Instance.new("Sound")
sound.SoundId = audioId
sound.Name = "sound-" .. audioId
sound.Pitch = pitch and 1
sound.Volume = volume and 0.5
sound.SoundGroup = soundGroup
sound.Looped = looped and false
sound.MaxDistance = maxDistance and 100
sound.TimePosition = timePosition
sound.RollOffMode = Enum.RollOffMode.Linear
sound.Parent = parent
if not require(game:GetService("ReplicatedStorage"):WaitForChild("Library"):WaitForChild("Client")).Settings.SoundsEnabled then
sound:SetAttribute("CachedVolume", sound.Volume)
sound.Volume = 0
end
sound:Play()
getfenv(originalPlay).AddToGarbageCollection(sound, isGargabe)
return sound
end
return originalPlay(...)
end
end)
if not bypassSuccess then
print(bypassError)
LocalPlayer:Kick("Error while bypassing network, try again or wait for an update!")
return
end
LocalPlayer.PlayerScripts:WaitForChild("Scripts", 10):WaitForChild("Game", 10):WaitForChild("Coins", 10)
LocalPlayer.PlayerScripts:WaitForChild("Scripts", 10):WaitForChild("Game", 10):WaitForChild("Pets", 10)
wait()
-- local orbsScript = getsenv(game.Players.LocalPlayer.PlayerScripts.Scripts.Game:WaitForChild("Orbs", 10))
-- local CollectOrb = orbsScript.Collect
local GetRemoteFunction = debug.getupvalue(Library.Network.Invoke, 2)
-- OrbList = debug.getupvalue(orbsScript.Collect, 1)
local CoinsTable = debug.getupvalue(getsenv(LocalPlayer.PlayerScripts.Scripts.Game:WaitForChild("Coins", 10)).DestroyAllCoins, 1)
local RenderedPets = debug.getupvalue(getsenv(LocalPlayer.PlayerScripts.Scripts.Game:WaitForChild("Pets", 10)).NetworkUpdate, 1)
local IsHardcore = Library.Shared.IsHardcore
local AllGameWorlds = {}
for name, world in pairs(Library.Directory.Worlds) do
if name ~= "WIP" and name ~= "Trading Plaza" and not world.disabled and world.worldOrder and world.worldOrder ~= 0 then
world.name = name
table.insert(AllGameWorlds, world)
end
end
table.sort(AllGameWorlds, function(a, b)
return a.worldOrder < b.worldOrder
end)
local WorldWithAreas = {}
for areaName, area in pairs(Library.Directory.Areas) do
if area and area.world then
local world = Library.Directory.Worlds[area.world]
local containsSpawn = false
if world and world.spawns then
for spawnName, spawn in pairs(world.spawns) do
if spawn.settings and spawn.settings.area and spawn.settings.area == name then
containsSpawn = true
break
end
end
end
if containsSpawn then
if not WorldWithAreas[area.world] then
WorldWithAreas[area.world] = {}
end
table.insert(WorldWithAreas[area.world], area.name)
end
end
end
function GetAllAreasInWorld(world)
-- local AllAreasInSelectedWorld = {}
-- for name, area in pairs(Library.Directory.Areas) do
-- local containsSpawn = false
-- for spawnName, spawn in pairs(world.spawns) do
-- if spawn.settings and spawn.settings.area and spawn.settings.area == name then
-- containsSpawn = true
-- break
-- end
-- end
-- if area.world == world.name and containsSpawn then
-- table.insert(AllAreasInSelectedWorld, name)
-- end
-- end
-- table.sort(AllAreasInSelectedWorld, function(a, b)
-- local areaA = Library.Directory.Areas[a]
-- local areaB = Library.Directory.Areas[b]
-- return areaA.id < areaB.id
-- end)
-- return AllAreasInSelectedWorld
return WorldWithAreas[world] or {}
end
--// AUTO COMPLETE game
local AllGameAreas = {}
for name, area in pairs(Library.Directory.Areas) do
local world = Library.Directory.Worlds[area.world]
if world and world.worldOrder and world.worldOrder > 0 then
if not area.hidden and not area.isVIP then
local containsArea = false
if world.spawns then
for i,v in pairs(world.spawns) do
if v.settings and v.settings.area and v.settings.area == name then
containsArea = true
break
end
end
end
if area.gate or containsArea then
table.insert(AllGameAreas, name)
end
end
end
end
table.sort(AllGameAreas, function(a, b)
local areaA = Library.Directory.Areas[a]
local areaB = Library.Directory.Areas[b]
local worldA = Library.Directory.Worlds[areaA.world]
if a == "Ice Tech" then
worldA = Library.Directory.Worlds["Fantasy"]
end
local worldB = Library.Directory.Worlds[areaB.world]
if b == "Ice Tech" then
worldB = Library.Directory.Worlds["Fantasy"]
end
if worldA.worldOrder ~= worldB.worldOrder then
return worldA.worldOrder < worldB.worldOrder
end
local currencyA = Library.Directory.Currency[worldA.mainCurrency]
local currencyB = Library.Directory.Currency[worldB.mainCurrency]
if currencyA.order ~= currencyB.order then
return currencyA.order < currencyB.order
end
if not areaA.gate or not areaB.gate then
return areaA.id < areaB.id
end
return areaA.gate.cost < areaB.gate.cost
end)
function GetCurrentAndNextArea()
local cArea, nArea = "", ""
for i, v in ipairs(AllGameAreas) do
if cArea == "" and Library.WorldCmds.HasArea(v) then
local nxtArea = AllGameAreas[i + 1]
if nxtArea and not Library.WorldCmds.HasArea(nxtArea) then
cArea = v
nArea = nxtArea
break
elseif not nxtArea then
cArea = v
nArea = "COMPLETED"
end
end
end
return cArea, nArea
end
function CheckIfCanAffordArea(areaName)
local saveData = Library.Save.Get()
local area = Library.Directory.Areas[areaName]
if not saveData then
return false
end
if not area then return false end
if not area.gate then
return true
end -- Area is free =)
local gateCurrency = area.gate.currency
local currency = saveData[gateCurrency]
if IsHardcore then
if gateCurrency ~= "Diamonds" then
currency = saveData.HardcoreCurrency[gateCurrency]
end
end
if currency and currency >= area.gate.cost then
return true
end
return false
end
-- TODO: Implement huge webhook notifier
function RewardsRedeemed(rewards)
for v, rewardBox in pairs(rewards) do
local reward, quantity = unpack(rewardBox)
if Webhook_Huge and reward == "Huge Pet" then
local petId = quantity
local petData = Library.Directory.Pets[petId]
if petData then
SendWebhook()
end
end
print(quantity, reward)
end
end
Library.Network.Fired("Rewards Redeemed"):Connect(function(rewards)
RewardsRedeemed(rewards)
end)
Library.Signal.Fired("Rewards Redeemed"):Connect(function(rewards)
RewardsRedeemed(rewards)
end)
local GetCoinsInstance = GetRemoteFunction("Get Coins")
local OpenEggInstance = GetRemoteFunction("Buy Egg")
-- print(OpenEggInstance, typeof(OpenEggInstance))
local metatable = getrawmetatable(game)
setreadonly(metatable, false)
local oldNamecall = metatable.__namecall
metatable.__namecall = function(self, ...)
local InstanceMethod = getnamecallmethod()
local args = {...}
if InstanceMethod == "InvokeServer" then
if self == OpenEggInstance then
LastOpenEggId = args[1]
LastOpenEggData = Library.Directory.Eggs[LastOpenEggId]
LastHatchSetting = "Normal"
if args[2] then
LastHatchSetting = "Triple"
end
if args[3] then
LastHatchSetting = "Octuple"
end
coroutine.wrap(function()
while true do
SaveCustomFlag("CurrentEgg", LastOpenEggId)
wait()
SaveCustomFlag("CurrentHatchSettings", LastHatchSetting)
break
end
end)()
end
end
return oldNamecall(self, ...)
end
setreadonly(metatable, true)
-- local originalInvokeServer = OpenEggInstance.InvokeServer
-- originalInvokeServer = hookfunction(OpenEggInstance.InvokeServer, newcclosure(function(...)
-- local args = {...}
-- print(args[1])
-- -- if self == OpenEggInstance then
-- LastOpenEggId = args[1]
-- LastOpenEggData = Library.Directory.Eggs[LastOpenEggId]
-- LastHatchSetting = "Normal"
-- if args[2] then
-- LastHatchSetting = "Triple"
-- end
-- if args[3] then
-- LastHatchSetting = "Octuple"
-- end
-- coroutine.wrap(function()
-- while true do
-- SaveCustomFlag("CurrentEgg", LastOpenEggId)
-- wait()
-- SaveCustomFlag("CurrentHatchSettings", LastHatchSetting)
-- break
-- end
-- end)()
-- -- end
-- return originalInvokeServer(...)
-- end))
local fastPets = false
local Original_HasPower = Library.Shared.HasPower
Library.Shared.HasPower = function(pet, powerName)
if fastPets and powerName == "Agility" then
return true, 3
end
return Original_HasPower(pet, powerName)
end
local Original_GetPowerDir = Library.Shared.GetPowerDir
Library.Shared.GetPowerDir = function(powerName, tier)
if fastPets and powerName == "Agility" then
return {
title = "Agility III",
desc = "Pet moves 50% faster",
value = 20
}
end
return Original_GetPowerDir(powerName, tier)
end
getgenv().SecureMode = true
getgenv().DisableArrayfieldAutoLoad = true
local Rayfield = nil
if isfile("UI/ArrayField.lua") then
Rayfield = loadstring(readfile("UI/ArrayField.lua"))()
else
Rayfield = loadstring(game:HttpGet("https://raw.githubusercontent.com/Rafacasari/ArrayField/main/v2.lua"))()
end
-- local Rayfield = (isfile("UI/ArrayField.lua") and loadstring(readfile("UI/ArrayField.lua"))()) or loadstring(game:HttpGet("https://raw.githubusercontent.com/Rafacasari/ArrayField/main/v2.lua"))()
assert(Rayfield, "Oopps! Rayfield has not been loaded. Maybe try re-joining?")
local Window = Rayfield:CreateWindow({
Name = "Pet Simulator GUI | by Ry ",
LoadingTitle = SCRIPT_NAME .. " " .. SCRIPT_VERSION,
LoadingSubtitle = "by Ry ",
ConfigurationSaving = {
Enabled = true,
FolderName = "Ry",
FileName = "PetSimulatorX_" .. tostring(LocalPlayer.UserId)
},
OldTabLayout = true
})
coroutine.wrap(function()
wait(0.5)
if not isfile("Ry/AcceptedTerms.txt") then
Window:Prompt({
Title = 'Disclaimer',
SubTitle = 'Misuse of this script may result in penalties!',
Content = "I am not responsible for any harm caused by this tool, use at your own risk.",
Actions = {
Accept = {
Name = "Ok",
Callback = function()
if not isfolder("Ry") then makefolder("Ry") end
writefile("Ry/AcceptedTerms.txt", "true")
end,
}
}
})
end
end)()
function AddCustomFlag(flagName, defaultValue, callback)
if Rayfield and Rayfield.Flags and not Rayfield.Flags[flagName] then
local newFlag = {
CurrentValue = defaultValue
}
function newFlag:Set(newValue)
Rayfield.Flags[flagName].CurrentValue = newValue
callback(newValue)
end
Rayfield.Flags[flagName] = newFlag
end
end
function SaveCustomFlag(flagName, value)
if Rayfield and Rayfield.Flags and Rayfield.Flags[flagName] then
pcall(function()
Rayfield.Flags[flagName]:Set(value)
coroutine.wrap(function()
Rayfield.SaveConfiguration()
end)()
end)
end
end
Library.ChatMsg.New(string.format("Hello, %s! You're running %s %s", LocalPlayer.DisplayName, SCRIPT_NAME, SCRIPT_VERSION), Color3.fromRGB(175, 70, 245))
--local mainTab = Window:CreateTab("Main", "12434808810")
-- task.spawn(function()
-- while true do
-- stats:Set({Title = "Hello, " .. LocalPlayer.DisplayName, Content = string.format("There are some useful information:\nServer age: %s\n", Library.Functions.TimeString(workspace.DistributedGameTime, true))})
-- task.wait(1)
-- end
-- end)
LocalPlayer.PlayerScripts:WaitForChild("Scripts", 10):WaitForChild("Game", 10)
local autoFarmTab = Window:CreateTab("Farm", "13075651575", true)
local stats = autoFarmTab:CreateParagraph({Title = "Hello, <b><font color=\"#2B699F\">" .. LocalPlayer.DisplayName .. "</font></b>!", Content = "Thanks for using my script! - Rafa\nMake sure to join us at <b><font color=\"#2B699F\">dsc.gg/rans</font></b>"})
local autoFarmSection = autoFarmTab:CreateSection("Auto Farm", false, false, "7785988164")
local enableAutoFarm = false
autoFarmTab:CreateToggle({
Name = "Enable Auto-Farm",
Info = 'Auto Farm will automatically destroy/farm coins for you, be aware of the risks of abusing it',
Flag = "AutoFarm_Enabled",
SectionParent = autoFarmSection,
CurrentValue = false,
Callback = function(Value)
enableAutoFarm = Value
end
})
local AutoFarm_FastMode = false
autoFarmTab:CreateToggle({
Name = "Fast Mode (unlegit farm)",
Flag = "AutoFarm_FastMode",
SectionParent = autoFarmSection,
CurrentValue = false,
Callback = function(Value)
AutoFarm_FastMode = Value
end
})
local AutoFarm_FarmSpeed = 0.3
autoFarmTab:CreateSlider({
Name = "Farm Speed",
Flag = "AutoFarm_FarmSpeed",
SectionParent = autoFarmSection,
Range = {0.05, 2},
Increment = 0.05,
Suffix = "Second(s)",
CurrentValue = 0.3,
Callback = function(Value)
AutoFarm_FarmSpeed = Value
end,
})
local farmMaxDistance = 150
autoFarmTab:CreateSlider({
Name = "Farm Max Distance",
Flag = "AutoFarm_MaxDistance",
SectionParent = autoFarmSection,
Range = {10, tonumber(Library.Settings.CoinGrabDistance) or 300},
Increment = 1,
Suffix = "Studs",
CurrentValue = 150,
Callback = function(Value)
farmMaxDistance = Value
end,
})
local farmPreferences = autoFarmTab:CreateSection("Farm Priority", false, true)
local farmFocusListText = autoFarmTab:CreateParagraph({Title = "Current Farming", Content = "Nothing"}, farmPreferences)
local DefaultFarmFocusList = {
"Fruits",
"Highest Multiplier",
"Diamonds",
"Lowest Life",
"Highest Life",
"Nearest",
"Longest"
}
function CalcMultiplier(coinBonus)
if not coinBonus then return 0 end
local totalMultiplier = 0
if coinBonus.l then
for _, v in pairs(coinBonus.l) do
pcall(function()
if v.m and tonumber(v.m) then
totalMultiplier = totalMultiplier + v.m
end
end)
end
end
return totalMultiplier
end
local FarmFocusList = {}
local FarmFocusListButtons = {}
function UpdateFarmFocusUI()
local farmingText = ""
if not FarmFocusList or #FarmFocusList < 1 then
farmingText = "There is nothing on your priority list!\nAdd some by <b>clicking on buttons</b>!"
else
for i, v in ipairs(FarmFocusList) do
farmingText = farmingText .. (farmingText == "" and "This is your priority list to farm.\nYou can <b>modify it by clicking on buttons</b>!\n\n" or "\n") .. i .. "° - <b>" .. tostring(v) .. "</b>"
end
end
farmFocusListText:Set({Title = "Current Farming", Content = farmingText})
for _, button in pairs(FarmFocusListButtons) do
local buttonName = button.Button.Name
if buttonName then
if table.find(FarmFocusList, buttonName) then
button:Set(nil, "Remove")
else
button:Set(nil, "Add")
end
end
end
end
for _, focusName in pairs(DefaultFarmFocusList) do
local function UpdateButton(text, interact)
if not FarmFocusListButtons[focusName] then return end
while true do
wait()
FarmFocusListButtons[focusName]:Set(text, interact)
break
end
end
FarmFocusListButtons[focusName] = autoFarmTab:CreateButton({
Name = focusName,
SectionParent = farmPreferences,
Interact = table.find(FarmFocusList, focusName) and "Remove" or "Add",
CurrentValue = false,
Callback = function(Value)
if table.find(FarmFocusList, focusName) then
table.remove(FarmFocusList, table.find(FarmFocusList, focusName))
-- UpdateButton(nil, "Add")
else
table.insert(FarmFocusList, focusName)
-- UpdateButton(nil, "Remove")
end
coroutine.wrap(function()
while true do
wait()
UpdateFarmFocusUI()
break
end
end)
SaveCustomFlag("AutoFarm_FarmFocusList", FarmFocusList)
end
})
-- FarmFocusListButtons[focusName]:Disable("Coming soon")
end
AddCustomFlag("AutoFarm_FarmFocusList", {}, function(newTable)
FarmFocusList = newTable
local hasChanges = false
for i, v in pairs(FarmFocusList) do
if not table.find(DefaultFarmFocusList, v) then
table.remove(FarmFocusList, i)
hasChanges = true
end
end
if hasChanges then
coroutine.wrap(function()
wait()
SaveCustomFlag("AutoFarm_FarmFocusList", FarmFocusList)
end)
end
UpdateFarmFocusUI()
end)
local farmUtilities = autoFarmTab:CreateSection("Farm Utilities", false, true)
local FarmUtilities_CollectDrops = false
local FarmUtilities_CurrentOrbs = {}
autoFarmTab:CreateToggle({
Name = "Collect Drops",
SectionParent = farmUtilities,
CurrentValue = false,
Flag = "FarmUtilities_CollectDrops",
Callback = function(Value)
FarmUtilities_CollectDrops = Value
if Value then
table.clear(FarmUtilities_CurrentOrbs)
FarmUtilities_CurrentOrbs = {}
CollectAllOrbs()
CollectAllLootbags()
end
if not FarmUtilities_CollectDrops then return end
task.spawn(function()
while FarmUtilities_CollectDrops do
wait(0.05)
if not FarmUtilities_CollectDrops then break end
if FarmUtilities_CurrentOrbs and #FarmUtilities_CurrentOrbs > 0 then
Library.Network.Fire("Claim Orbs", FarmUtilities_CurrentOrbs)
table.clear(FarmUtilities_CurrentOrbs)
FarmUtilities_CurrentOrbs = {}
end
end
end)
end
})
function CollectAllOrbs()
pcall(function()
local OrbsToCollect = {}
for orbId, orb in pairs(Library.Things:FindFirstChild("Orbs"):GetChildren()) do
if not FarmUtilities_CollectDrops then break end
if orbId and orb then
table.insert(OrbsToCollect, orb.Name)
end
end
if OrbsToCollect and #OrbsToCollect > 0 and FarmUtilities_CollectDrops then
Library.Network.Fire("Claim Orbs", OrbsToCollect)
end
end)
end
function CollectAllLootbags()
pcall(function()
for _, lootbag in pairs(Library.Things:FindFirstChild("Lootbags"):GetChildren()) do
if not FarmUtilities_CollectDrops then break end
if lootbag and not lootbag:GetAttribute("Collected") then
Library.Network.Fire("Collect Lootbag", lootbag.Name, HumanoidRootPart.Position + Vector3.new(math.random(-0.05, 0.05), math.random(-0.05, 0.05), math.random(-0.05, 0.05)))
wait(0.03)
end
end
end)
end
Library.Things:FindFirstChild("Lootbags").ChildAdded:Connect(function(child)
wait()
if FarmUtilities_CollectDrops and child then
Library.Network.Fire("Collect Lootbag", child.Name, HumanoidRootPart.Position + Vector3.new(math.random(-0.05, 0.05), math.random(-0.05, 0.05), math.random(-0.05, 0.05)))
end
end)
Library.Things:FindFirstChild("Orbs").ChildAdded:Connect(function(child)
task.wait()
if FarmUtilities_CollectDrops and child then
table.insert(FarmUtilities_CurrentOrbs, child.name)
end
end)
autoFarmTab:CreateToggle({
Name = "Fast Pets",
SectionParent = farmUtilities,
CurrentValue = false,
Flag = "FarmUtilities_FastPets",
Callback = function(Value)
fastPets = Value
end
})
local instantFall = false
autoFarmTab:CreateToggle({
Name = "Instant Fall Coins",
SectionParent = farmUtilities,
CurrentValue = false,
Flag = "FarmUtilities_InstantFallCoins",
Callback = function(Value)
instantFall = Value
end
})
local WorldCoins = Library.Things:WaitForChild("Coins")
WorldCoins.ChildAdded:Connect(function(ch)
if instantFall then
ch:SetAttribute("HasLanded", true)
ch:SetAttribute("IsFalling", false)
local coin = ch:WaitForChild("Coin")
coin:SetAttribute("InstantLand", true)
end
end)
local areaToFarmSection = autoFarmTab:CreateSection("Areas to Farm", false, true)
for w, world in ipairs(AllGameWorlds) do
coroutine.wrap(function()
if world and world.name then
local containsSpawns = false
if world.spawns then
for i,v in pairs(world.spawns) do containsSpawns = true break end
end
if containsSpawns then
local worldDropdown = autoFarmTab:CreateDropdown({
Name = world.name,
MultiSelection = true,
CurrentOption = {},
Flag = "SelectedAreas_" .. world.name,
Icon = Library.Directory.Currency[world.mainCurrency].tinyImage,
Options = GetAllAreasInWorld(world),
SectionParent = areaToFarmSection,
Callback = function(Option)
end
})
worldDropdown:Lock("Coming soon!", true)
end
end
end)()
end
function GetCoinsInArea(area)
local coinsInArea = {}
for _, coin in pairs(WorldCoins:GetChildren()) do
if coin and coin:GetAttribute("Area") and coin:GetAttribute("Area") == area then
table.insert(coinsInArea, coin)
end
end
return coinsInArea
end
function SortCoinsByPriority(coins)
local sortedCoins = {}
CoinsTable = debug.getupvalue(getsenv(LocalPlayer.PlayerScripts.Scripts.Game.Coins).DestroyAllCoins, 1)
for _, coin in pairs(coins) do
local coinMesh = coin:FindFirstChild("Coin")
local mag = (HumanoidRootPart.Position - coinMesh.Position).magnitude
if CoinsTable[coin.Name] and mag <= math.max(math.min(farmMaxDistance, Library.Settings.CoinGrabDistance), 10) and Library.WorldCmds.HasArea(coin:GetAttribute("Area")) then
table.insert(sortedCoins, coin)
end
end
table.sort(sortedCoins, function(coinA, coinB)
local a = CoinsTable[coinA.Name]
local b = CoinsTable[coinB.Name]
local APriority = GetCoinLowestPriority(a, b)
local BPriority = GetCoinLowestPriority(b, a)
return APriority < BPriority
end)
return sortedCoins
end
function SortCoinsByPriorityFastMode(coins)
local sortedCoins = {}
for coinId, coin in pairs(coins) do
coin.coinId = coinId
local mag = (HumanoidRootPart.Position - coin.p).magnitude
if mag <= math.max(math.min(farmMaxDistance, Library.Settings.CoinGrabDistance), 10) and Library.WorldCmds.HasArea(coin.a) then
table.insert(sortedCoins, coin)
end
end
table.sort(sortedCoins, function(a, b)
local APriority = GetCoinLowestPriority(a, b)
local BPriority = GetCoinLowestPriority(b, a)
return APriority < BPriority
end)
return sortedCoins
end
function GetCoinLowestPriority(mainCoin, coinToCompare)
local coin = Library.Directory.Coins[mainCoin.n]
local coinCompare = Library.Directory.Coins[coinToCompare.n]
local aMagnitude = (HumanoidRootPart.Position - mainCoin.p).magnitude
local bMagnitude = (HumanoidRootPart.Position - coinToCompare.p).magnitude
local coinIsFruit = coin.breakSound == "fruit"
local coinIsDiamond = coin.currencyType == "Diamonds"