-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThe survival game2
1003 lines (852 loc) · 32.5 KB
/
The survival game2
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
-- // The Survival Game Script, orignally written for v3, ported to v2. Enjoy!
--[[ TODO
- CONFIG SYSTEM
]]
if getgenv().TSG_LOADED then
return warn("[tgs.lua] script already loaded, rejoin to re-execute.")
else
getgenv().TSG_LOADED = true
end
local entity = loadstring(game:HttpGet("https://github.com/joeengo/VapeV4ForRoblox/blob/main/Libraries/entityHandler.lua?raw=true", true))()
entity.fullEntityRefresh()
local library = loadstring(game:HttpGet("https://github.com/joeengo/exploiting/blob/main/UILibrary.lua?raw=true", true))()
library:Init("tsg.lua v1.03a | discord.gg/WYvnhbkwAA | engo#0320")
local collectionService = game:GetService("CollectionService")
local guiService = game:GetService("GuiService")
local players = game:GetService("Players")
local lplr = players.LocalPlayer
local cam = workspace.CurrentCamera
local rs = game:GetService("ReplicatedStorage")
local runService = game:GetService("RunService")
local uis = game:GetService("UserInputService")
local tsg = {}
local resolvePath
local funcs = {}; do
function funcs.getEntityFromPlayerName(name)
local player = players:FindFirstChild(name)
if not player then
return
end
local ind, ent = entity.getEntityFromPlayer(player)
return ent
end
function funcs.getClosestEntity(max)
if not entity.isAlive then
return
end
local selfPos = entity.character.HumanoidRootPart.Position
local dist, res = max or 9e9, nil
for i, ent in next, entity.entityList do
if ent.Targetable then
local d = (ent.HumanoidRootPart.Position - selfPos).Magnitude
if (d < dist) then
res = ent
dist = d
end
end
end
return res
end
function funcs.getColorFromHealthPercentage(percentage)
return Color3.fromHSV(percentage / 3, 1, 1) -- Makes 100% health = 0.33333 which is green.
end
local waitCache = {}
function funcs.waitForChild(parent, childName, timeOut)
local key = parent:GetDebugId(99999) .. childName
if not waitCache[key] then
waitCache[key] = parent:FindFirstChild(childName) or parent:WaitForChild(childName, timeOut)
end
return waitCache[key]
end
function funcs.createAngleInc(Start, DefaultInc, Goal)
local i = Start or 0
return function(Inc)
local Inc = Inc or DefaultInc or 1
i = math.clamp(i + Inc, Start, Goal)
return i
end
end
function funcs.circle(Self, Target, Radius, Delay, Speed, stopIf, onStop, YOffset)
local AngleInc = funcs.createAngleInc(0, Speed, 360)
for i = 1, 360 / Speed do
local Angle = AngleInc(Speed)
Self.CFrame = CFrame.new(Target.CFrame.p) * CFrame.Angles(0, math.rad(Angle), 0) * CFrame.new(0, YOffset, Radius)
task.wait(Delay)
if stopIf and stopIf() then
return onStop and onStop()
end
end
end
function funcs.getBestTool(type, stat)
local hotbar = tsg.ClientData.getHotbar()
local most, best = 0, nil
for hotbarSlot, itemId in next, hotbar do
if itemId < 0 then
continue
end
local itemData = tsg.Items.getItemData(itemId)
if table.find(itemData.itemType, type) then
if itemData.itemStats[stat] > most then
best = hotbarSlot
most = itemData.itemStats[stat]
end
end
end
return best
end
function funcs.getBestId(type, stat)
local inv = tsg.ClientData.getInventory()
local most, best = 0, nil
for itemId, amount in next, inv do
if itemId < 0 then
continue
end
local itemData = tsg.Items.getItemData(itemId)
if table.find(itemData.itemType, type) then
if itemData.itemStats[stat] > most then
best = itemId
most = itemData.itemStats[stat]
end
end
end
return best
end
function funcs.getClosestAnimal(max)
if not entity.isAlive then
return
end
local selfPos = entity.character.HumanoidRootPart.Position
local dist, res = max or 9e9, nil
for i, animal in next, tsg.Animals do
if animal.PrimaryPart and (not animal:GetAttribute("deadFrom")) then
local d = (animal.PrimaryPart.Position - selfPos).Magnitude
if (d < dist) then
res = animal
dist = d
end
end
end
return res
end
function funcs.playAnimation(id)
if entity.isAlive then
local animation = Instance.new("Animation")
animation.AnimationId = id
local animatior = entity.character.Humanoid.Animator
animatior:LoadAnimation(animation):Play()
end
end
function funcs.getEquippedId()
if not entity.isAlive then
return -1
end
local hotbar = tsg.ClientData.getHotbar()
for i, v in next, hotbar do
local tool = lplr.Character:FindFirstChild(tostring(i))
if tool and tool:IsA("Tool") then
return v
end
end
return -1
end
-- This function is just skidded from in game code lol (players.LocalPlayer.Character["1"].slotTool.Ranged_CHARGED)
function funcs.getShootTarget()
if tsg.fpsUtil.inFirstPerson() then
local cf = cam.CFrame
return cf.Position + (cf.LookVector * 1000)
end
local mousePos = uis:GetMouseLocation() - guiService:GetGuiInset()
local ray = cam:ScreenPointToRay(mousePos.X, mousePos.Y)
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
rayParams.FilterDescendantsInstances = {
lplr.Character,
resolvePath(workspace, "snaps")
}
local hit = workspace:Raycast(ray.Origin, ray.Direction * 500, rayParams)
if hit then
return hit.Position
end
return ray.Origin + (ray.Direction * 1000)
end
function funcs.getShootCF()
if not entity.isAlive then
return
end
if tsg.fpsUtil.inFirstPerson() then
return cam.CFrame
end
return CFrame.new(lplr.Character:GetPivot().Position, funcs.getShootTarget())
end
function funcs.solveQuadratic(a, b, c) -- Solves quadratic equation, always returns the positive output.
local d = (b ^ 2) - (a * c * 4)
local e = (-b) + (d ^ 0.5)
return e / (a * 2)
end
--[[
function funcs.prediction(selfPart, part, speed)
local speed = speed.Magnitude
local targetPosition = part.Position
local targetVelocity = part.Velocity
local shooterPosition = selfPart.Position
local relative = shooterPosition - targetPosition
local angle = math.acos(relative.Unit:Dot(targetVelocity.Unit))
if targetVelocity == Vector3.zero then
return targetPosition
end
local a,b,c =
(targetVelocity.magnitude ^ 2) - (speed ^ 2),
-2 * relative.magnitude * math.cos(angle) * targetVelocity.magnitude,
relative.magnitude ^ 2
print("------------------")
print(a, b, c)
print(speed)
print(targetPosition)
print(targetVelocity)
print(shooterPosition)
print(relative)
print(angle)
local t = funcs.solveQuadratic(a,b,c)
return targetPosition + targetVelocity * t
end
]]
local FACTOR = 0.15
local Y_OFFSET = 2
local Y_FACTOR = 0.08
function funcs.prediction(selfPart, part, speed)
local add = part.Velocity
add = Vector3.new(add.X * FACTOR, (add.Y * Y_FACTOR) + Y_OFFSET, add.Z * FACTOR)
return part.Position + add
end
end
function resolvePath(parent, ...)
local last = parent
for i, v in next, {...} do
last = funcs.waitForChild(last, v)
end
return last
end
local hookfunc = hookfunction
function hookfunction(from, to, backup)
local suc, res = pcall(hookfunc, from, to)
if suc then
return res
end
return backup()
end
tsg = {
ClientData = require(resolvePath(rs, "modules", "player", "ClientData")),
Sounds = require(resolvePath(rs, "modules", "misc", "Sounds")),
Items = require(resolvePath(rs, "game", "Items")),
Effects = require(resolvePath(rs, "game", "Effects")),
fpsUtil = require(resolvePath(rs, "modules", "misc", "fpsUtil")),
MeleePlayerRemote = resolvePath(rs, "remoteInterface", "interactions", "meleePlayer"),
MeleeAnimalRemote = resolvePath(rs, "remoteInterface", "interactions", "meleeAnimal"),
EatRemote = resolvePath(rs, "remoteInterface", "interactions", "eat"),
MineRemote = resolvePath(rs, "remoteInterface", "interactions", "mine"),
ChopRemote = resolvePath(rs, "remoteInterface", "interactions", "chop"),
ShootRemote = resolvePath(rs, "remoteInterface", "interactions", "shoot"),
ShotPlayerHitRemote = resolvePath(rs, "remoteInterface", "interactions", "shotHitPlayer"),
PickupRemote = resolvePath(rs, "remoteInterface", "inventory", "pickupItem"),
RespawnRemote = resolvePath(rs, "remoteInterface", "character", "respawn"),
FireRemote = resolvePath(rs, "remoteInterface", "world", "onFire"),
SetHungerEvent = resolvePath(rs, "remoteInterface", "playerData", "setHunger"),
}
getgenv().tsg = tsg -- So i can do testing outside of this script.
local animalContainer = resolvePath(workspace, "animals"); do
local function addAnimal(v)
table.insert(tsg.Animals, v)
end
tsg.Animals = tsg.Animals or {}
animalContainer.ChildAdded:Connect(addAnimal)
for i, v in next, animalContainer:GetChildren() do
addAnimal(v)
end
end
do -- KILLAURA
local circling
local lastHit = 0
local lastAnim = 0
local circle, circleSpeed, circleRadius
local animals
local players
local highlight
local highlightInstance = Instance.new("Highlight")
highlightInstance.FillColor = Color3.new(1, 0, 0)
highlightInstance.OutlineColor = Color3.new(1, 1, 1)
highlightInstance.FillTransparency = 0.2
highlightInstance.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
local killaura; killaura = library:Toggle({
Name = "Killaura",
Default = false,
Function = function(value)
if value then
task.spawn(function()
repeat task.wait()
local closestEntity = players.Enabled and funcs.getClosestEntity(16)
local closestAnimal = animals.Enabled and funcs.getClosestAnimal(16)
local bestWeapon = funcs.getBestTool("Melee Weapon", "meleeDamage")
local shouldAttack = (tick() - lastHit >= 0.25)
local shouldAnim = (tick() - lastAnim >= 1)
-- TODO: make highlight for animal while attacking player and animal
if bestWeapon and (closestEntity or closestAnimal) then
if highlight.Enabled then
highlightInstance.Parent = closestEntity and closestEntity.Character or closestAnimal
highlightInstance.Adornee = closestEntity and closestEntity.Character or closestAnimal
else
highlightInstance.Parent = nil
highlightInstance.Adornee = nil
end
if circle.Enabled then
--cam.CameraSubject = closestEntity and closestEntity.Character or closestAnimal
task.spawn(function()
if circling then
return
end
circling = true
funcs.circle(entity.character.HumanoidRootPart, (closestEntity or closestAnimal).HumanoidRootPart, circleRadius.Value, 0, circleSpeed.Value, function()
return not ((closestAnimal and closestEntity) or killaura.Enabled or circle.Enabled)
end, nil, 0)
circling = false
end)
end
if shouldAnim then
funcs.playAnimation("rbxassetid://11370416454") -- TODO: make this use game funcs because good!!!
tsg.Sounds.playGameSound("HitPlayer")
lastAnim = tick()
end
if not shouldAttack then
continue
end
lastHit = tick()
if closestEntity then
tsg.MeleePlayerRemote:FireServer(bestWeapon, closestEntity.Player)
end
if closestAnimal then
tsg.MeleeAnimalRemote:FireServer(bestWeapon, closestAnimal)
end
elseif shouldAttack then
cam.CameraSubject = lplr.Character
highlightInstance.Parent = nil
highlightInstance.Adornee = nil
end
until not killaura.Enabled
end)
else
cam.CameraSubject = lplr.Character
highlightInstance.Parent = nil
highlightInstance.Adornee = nil
end
end
})
circle = library:Toggle({
Name = "Circle Target",
Default = false,
Function = function(value)
if value then
else
--cam.CameraSubject = lplr.Character
end
end
})
circleSpeed = library:Slider({
Name = "Circle Speed",
Function = function() end,
Min = 1,
Max = 50,
Default = 10,
Decimals = 0,
})
circleRadius = library:Slider({
Name = "Circle Radius",
Function = function() end,
Min = 1,
Max = 15,
Default = 13.5,
Decimals = 2,
})
highlight = library:Toggle({
Name = "Highlight Target",
Default = true,
Function = function(value)
highlightInstance.Enabled = value
end
})
players = library:Toggle({
Name = "Target Players",
Default = true,
Function = function(value)
end
})
animals = library:Toggle({
Name = "Target Animals",
Default = false,
Function = function(value)
end
})
end
library:Seperator()
do -- SPEED
local speed
local function onHeartbeat(dt)
if not speed.Enabled then
return
end
if not entity.isAlive then
return
end
local humanoid = entity.character.Humanoid
local humanoidRootPart = entity.character.HumanoidRootPart
local originalVelocity = humanoidRootPart.Velocity
local moveDirection = humanoid.MoveDirection
local factor = 27 - humanoid.WalkSpeed
local multMD = (moveDirection * dt) * factor
lplr.Character:TranslateBy(multMD)
end
speed = library:Toggle({
Name = "Speed",
Default = false,
Function = function() end
} )
runService.Heartbeat:Connect(onHeartbeat)
end
library:Seperator()
do -- AUTOEAT
local eatRaw
local hungerThreshold
local autoEatConnection
local autoEat = library:Toggle({
Name = "Auto Eat",
Default = false,
Function = function(value)
if value then
-- NOTE: Possibly the sethunger wont fire when ur on 0, possible item pickup check so if your on 0 then it will eat any items picked up to counter that.
autoEatConnection = tsg.SetHungerEvent.OnClientEvent:Connect(function(hunger)
if hunger >= hungerThreshold.Value - 0.1 then
return
end
for itemId, amount in next, tsg.ClientData.getInventory() do
local itemData = tsg.Items.getItemData(itemId)
if not table.find(itemData.itemType, "Consumable") then
continue
end
local shouldntEat = not eatRaw.Enabled and itemData.effectsOnEat and table.find(itemData.effectsOnEat, "Food_Poisoning")
if shouldntEat then
continue
end
tsg.Sounds.playGameSound("Eat Food")
tsg.EatRemote:FireServer(itemId)
break
end
end)
else
autoEatConnection:Disconnect()
end
end,
})
eatRaw = library:Toggle({
Name = "Eat Raw Food",
Default = false,
Function = function() end
})
hungerThreshold = library:Slider({
Name = "Goal Hunger",
Function = function() end,
Min = 1,
Max = resolvePath(rs, "game", "maxHunger").Value,
Default = 500,
Decimals = 0,
})
end
library:Seperator()
do -- SERVER LAGGER
local lagger; lagger = library:Toggle({
Name = "Server Lagger", -- credits to Babyhamsta#0173
Default = false,
Function = function(value)
if value then
task.spawn(function()
repeat task.wait()
task.spawn(function()
for i = 1, 5 do
tsg.RespawnRemote:InvokeServer(15382674, 1, 1, 20, 15382674, 15382674, false)
tsg.FireRemote:FireServer()
end
end)
until not lagger.Enabled
end)
end
end
})
end
library:Seperator()
do -- INF STAM
local oldStamina
local infStaminaConnection
local infStamina = library:Toggle({
Name = "Infinite Stamina",
Default = false,
Function = function(value)
if value then
oldStamina = lplr:GetAttribute("stamina")
lplr:SetAttribute("stamina", math.huge)
infStaminaConnection = lplr:GetAttributeChangedSignal("stamina"):Connect(function()
oldStamina = lplr:GetAttribute("stamina")
lplr:SetAttribute("stamina", math.huge)
end)
else
infStaminaConnection:Disconnect()
lplr:SetAttribute("stamina", oldStamina)
end
end
})
end
library:Seperator()
do -- ANTI ENCUMBER
local speedFactor
local antiEncumber = library:Toggle({
Name = "Anti Encumbered",
Default = false,
Function = function(value)
if value then
speedFactor = tsg.Effects.getEffectData("Over_Encumbered").speedFactor
tsg.Effects.getEffectData("Over_Encumbered").speedFactor = 1
else
tsg.Effects.getEffectData("Over_Encumbered").speedFactor = speedFactor
speedFactor = nil
end
end
})
end
library:Seperator()
do
local fastPickup; fastPickup = library:Toggle({
Name = "Fast Pickup",
Default = false,
Function = function(value)
if value then
task.spawn(function()
repeat task.wait(0.05)
if not entity.isAlive then
continue
end
local selfPos = entity.character.HumanoidRootPart.Position
for i, v in next, collectionService:GetTagged("DROPPED_ITEM") do -- TODO: Possibly cache/store dropped items in table, because gettagged maybe slow?
local dist = (v.Position - selfPos).Magnitude
if dist <= 5 then
tsg.PickupRemote:FireServer(v)
end
end
until not fastPickup.Enabled
end)
end
end
})
end
library:Seperator()
do -- BOW AIMBOT
local bowAimbot
local function hook(requiredScript)
local old
local function bowAimbotHook(...)
if bowAimbot.Enabled and entity.isAlive then
local closestEntity = funcs.getClosestEntity(200)
if not closestEntity then
return old(...)
end
local equippedId = funcs.getEquippedId()
local itemData = tsg.Items.getItemData(equippedId)
local projVelocity = itemData.projectileVelocity
local lookVec = CFrame.lookAt(entity.character.HumanoidRootPart.Position, closestEntity.HumanoidRootPart.Position).LookVector
local predicted = funcs.prediction(entity.character.HumanoidRootPart, closestEntity.HumanoidRootPart, projVelocity)
--printtable(predicted)
return CFrame.lookAt(entity.character.HumanoidRootPart.Position, predicted)
end
return old(...)
end
old = hookfunction(requiredScript._getShootCF, bowAimbotHook, function()
local old = requiredScript._getShootCF
requiredScript._getShootCF = bowAimbotHook
return old
end)
end
-- using the below 3 sections of code, we hook any present and future instances of the bow, allowing for no holes where the aimbot will fail.
local oldRequire
local function requireHook(scr) -- setup require to hook any future bows
local requiredScript = oldRequire(scr)
if scr.Name == "Ranged_NORMAL" or scr.Name == "Ranged_CHARGE" and (scr:IsDescendantOf(lplr.Backpack) or scr:IsDescendantOf(lplr.Character)) then
hook(requiredScript)
end
return requiredScript
end
oldRequire = hookfunction(getrenv().require, requireHook, function()
local old = getrenv().require
getrenv().require = requireHook
return old
end)
for i, v in next, lplr.Backpack:GetChildren() do -- setup the hook on any bows in inv
local slotTool = v:FindFirstChild("slotTool")
if slotTool then
local script1, script2 = slotTool:FindFirstChild("Ranged_CHARGE"), slotTool:FindFirstChild("Ranged_NORMAL")
if script1 and script2 then
hook(require(script1))
hook(require(script2))
end
end
end
if entity.isAlive then
local slotTool = lplr.Character:FindFirstChildWhichIsA("Tool") -- setup the hook on any currently selected bow
slotTool = slotTool and slotTool:FindFirstChild("slotTool")
if slotTool then
local script1, script2 = slotTool:FindFirstChild("Ranged_CHARGE"), slotTool:FindFirstChild("Ranged_NORMAL")
if script1 and script2 then
hook(require(script1))
hook(require(script2))
end
end
end
bowAimbot = library:Toggle({
Name = "Bow Aimbot",
Default = false,
Function = function(value)
end
})
end
library:Seperator()
do -- AUTO MINE
local wr = resolvePath(workspace, "worldResources")
local mineableToggles = {}
local connections = {}
local oreEsp, oreEspDist, oreEspMaxDist
local oreEsps = {}
local espFuncs = {
Add = function(instance)
if not instance then
return
end
if instance:GetAttribute("health") <= 0 then
return
end
local name = instance.Parent.Name
local selected = mineableToggles[name].Selected.Value
if selected ~= "ESP" and selected ~= "Both" then
return
end
local instPos = instance:GetAttribute("cf").Position
local pos, vis = cam:WorldToViewportPoint(instPos)
local dist = lplr:DistanceFromCharacter(instPos)
vis = dist < oreEspMaxDist.Value
if dist == 0 then
vis = false
end
local text = name
if oreEspDist.Enabled then
text = text .. " [" .. math.floor(dist) .. "]"
end
local drawing = Drawing.new("Text")
drawing.Visible = vis
drawing.Color = Color3.new(1, 1, 1)
drawing.Text = text
drawing.Size = 18
drawing.Position = Vector2.new(pos.X, pos.Y)
drawing.ZIndex = pos.Z
drawing.Outline = true
drawing.OutlineColor = Color3.new(0, 0, 0)
drawing.Center = true
table.insert(oreEsps, {
drawing = drawing,
instance = instance,
name = name,
instPos = instPos -- Store Instance Position because its unlikely it will change
})
end,
Update = function(esp, index)
local drawing = esp.drawing
local instPos = esp.instPos
local pos, vis = cam:WorldToViewportPoint(instPos)
local dist = lplr:DistanceFromCharacter(instPos)
if vis then
vis = dist < oreEspMaxDist.Value
end
if dist == 0 then
vis = false
end
local selected = mineableToggles[esp.name].Selected.Value
if selected ~= "ESP" and selected ~= "Both" then
drawing:Remove()
table.remove(oreEsps, index)
return
end
drawing.Visible = vis
if vis then
local text = esp.name
if oreEspDist.Enabled then
text = text .. " [" .. math.floor(dist) .. "]"
end
drawing.Position = Vector2.new(pos.X, pos.Y)
drawing.ZIndex = pos.Z
drawing.Text = text
end
end,
}
local function handleChild(v, v3)
local t = {i=v3,t=v.Name,cf=v3:GetAttribute("cf")}
table.insert(tsg.Mineables, t)
local connection; connection = v3:GetAttributeChangedSignal("health"):Connect(function()
if v3:GetAttribute("health") <= 0 then
table.remove(tsg.Mineables, table.find(tsg.Mineables, t))
end
connection:Disconnect()
end)
table.insert(connections, connection)
if oreEsp.Enabled then
espFuncs.Add(v3)
end
end
local function updateMineables()
tsg.Mineables = {}
for i, v in next, connections do
if v.Connected then
v:Disconnect()
end
connections[i] = nil
end
for i, v in next, wr:GetChildren() do
for i2, v2 in next, v:GetChildren() do
if mineableToggles[v2.Name].Selected.Value ~= "None" then
for i3, v3 in next, v2:GetChildren() do
handleChild(v, v3)
end
table.insert(connections, v2.ChildAdded:Connect(function(v3)
handleChild(v, v3)
end))
end
end
end
end
local highlight
local highlightInstance = Instance.new("Highlight")
highlightInstance.FillColor = Color3.new(0, 0, 1)
highlightInstance.OutlineColor = Color3.new(1, 1, 1)
highlightInstance.FillTransparency = 0.2
highlightInstance.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
local lastHit = tick()
local automine; automine = library:Toggle({
Name = "Auto Mine",
Default = false,
Function = function(value)
if value then
task.spawn(function()
repeat task.wait()
if not entity.isAlive then
continue
end
local thisTick = tick()
local shouldHit = (thisTick - lastHit >= 1/3)
if not shouldHit then
continue
end
local selfPos = entity.character.HumanoidRootPart.Position
local bestPick = funcs.getBestTool("Pickaxe", "pickaxeStrength")
local bestAxe = funcs.getBestTool("Axe", "axeStrength")
for i, v in next,tsg.Mineables do
local selected = mineableToggles[v.i.Parent.Name].Selected.Value
if selected ~= "AutoMine" and selected ~= "Both" then
continue
end
if (v.cf.Position - selfPos).Magnitude < 16 then
local remote = v.t == 'mineable' and tsg.MineRemote or tsg.ChopRemote
local bestTool = v.t == 'mineable' and bestPick or bestAxe
highlightInstance.Parent = v.i
highlightInstance.Adornee = v.i
for i = 1, 10 do
task.spawn(function()
remote:FireServer(bestTool, v.i, v.cf)
end)
end
lastHit = thisTick
break
else
--highlightInstance.Parent = nil
--highlightInstance.Adornee = nil
end
end
until not automine.Enabled
end)
else
highlightInstance.Parent = nil
highlightInstance.Adornee = nil
end
end,
})
highlight = library:Toggle({
Name = "Highlight Target",
Default = false,
Function = function(value)
highlightInstance.Enabled = value
end
})
library:Seperator()
local oreEspConnection
oreEsp = library:Toggle({
Name = "Resource ESP",
Default = false,
Function = function(value)
if value then
for i, v in next, tsg.Mineables do
espFuncs.Add(v.i)
end
oreEspConnection = runService.RenderStepped:Connect(function()
for i, v in next, oreEsps do
espFuncs.Update(v, i)
end
end)
else
oreEspConnection:Disconnect()
for i, v in next, oreEsps do
v.drawing:Remove()
end
oreEsps = {}
end
end
})
oreEspDist = library:Toggle({
Name = "Show Distance From Player",
Default = true,
Function = function() end
})
oreEspMaxDist = library:Slider({
Name = "Max Render Distance",
Default = 200,
Min = 0,
Max = 2000,
Function = function() end,
Decimals = 2
})
library:Seperator()
library:Element("Resource Toggles", false)
local doneLoading = false
for i, v in next, wr:GetChildren() do
for i2, v2 in next, v:GetChildren() do
mineableToggles[v2.Name] = library:Selector({
Name = v2.Name,
List = {"None", "ESP", "AutoMine", "Both"},
Function = function(value)
if not doneLoading then
return
end
updateMineables()
end,
Default = "Both",
})
end
end
doneLoading = true
updateMineables()
end
-- UI HIDE:
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.RightControl then