forked from Nolij/RandomStuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathESP.lua
More file actions
153 lines (135 loc) · 5.01 KB
/
ESP.lua
File metadata and controls
153 lines (135 loc) · 5.01 KB
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
-- ZoomUnlock by xdMatthewbx#1337
-- Copyright xdMatthewbx#1337 (Discord ID: 348696829648437249) 2020
-- For those of you who dont know what GPLv3 is:
-- I claim no responsibility for anything you or anyone else does with this script.
-- This script should be considered "use at your own risk".
-- Sharing this script without including the below license, attempting to sell this
-- script, and/or calling it your own are/is illegal, and is punishable by law.
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
local Holder = Instance.new("Folder", game:GetService("CoreGui"))
Holder.Name = "ESP"
local UpdateFuncs = {}
local Box = Instance.new("BoxHandleAdornment")
Box.Name = "nilBox"
Box.Size = Vector3.new(4, 7, 4)
Box.Color3 = Color3.new(100 / 255, 100 / 255, 100 / 255)
Box.Transparency = 0.7
Box.ZIndex = 0
Box.AlwaysOnTop = true
Box.Visible = true
local NameTag = Instance.new("BillboardGui")
NameTag.Name = "nilNameTag"
NameTag.Enabled = false
NameTag.Size = UDim2.new(0, 200, 0, 50)
NameTag.AlwaysOnTop = true
NameTag.StudsOffset = Vector3.new(0, 1.8, 0)
local Tag = Instance.new("TextLabel", NameTag)
Tag.Name = "Tag"
Tag.BackgroundTransparency = 1
Tag.Position = UDim2.new(0, -50, 0, 0)
Tag.Size = UDim2.new(0, 300, 0, 20)
Tag.TextSize = 20
Tag.TextColor3 = Color3.new(100 / 255, 100 / 255, 100 / 255)
Tag.TextStrokeColor3 = Color3.new(0 / 255, 0 / 255, 0 / 255)
Tag.TextStrokeTransparency = 0.4
Tag.Text = "nil"
Tag.Font = Enum.Font.SourceSansBold
Tag.TextScaled = false
local LoadCharacter = function(v)
repeat wait() until v.Character ~= nil
v.Character:WaitForChild("Humanoid")
local vHolder = Holder:FindFirstChild(v.Name)
vHolder:ClearAllChildren()
local b = Box:Clone()
b.Name = v.Name .. "Box"
b.Adornee = v.Character
b.Parent = vHolder
local t = NameTag:Clone()
t.Name = v.Name .. "NameTag"
t.Enabled = true
t.Parent = vHolder
t.Adornee = v.Character:WaitForChild("Head", 5)
if not t.Adornee then
return UnloadCharacter(v)
end
t.Tag.Text = v.Name
b.Color3 = Color3.new(v.TeamColor.r, v.TeamColor.g, v.TeamColor.b)
t.Tag.TextColor3 = Color3.new(v.TeamColor.r, v.TeamColor.g, v.TeamColor.b)
local UpdateNameTag = function()
if not pcall(function()
v.Character.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local maxh = math.floor(v.Character.Humanoid.MaxHealth)
local h = math.floor(v.Character.Humanoid.Health)
t.Tag.Text = v.Name .. "\n" .. ((maxh ~= 0 and tostring(math.floor((h / maxh) * 100))) or "0") .. "% " .. tostring(h) .. "/" .. tostring(maxh)
end) then
UpdateFuncs[v] = nil
end
end
UpdateNameTag()
UpdateFuncs[v] = UpdateNameTag
end
local UnloadCharacter = function(v)
local vHolder = Holder:FindFirstChild(v.Name)
if vHolder and (vHolder:FindFirstChild(v.Name .. "Box") ~= nil or vHolder:FindFirstChild(v.Name .. "NameTag") ~= nil) then
vHolder:ClearAllChildren()
end
end
local LoadPlayer = function(v)
local vHolder = Instance.new("Folder", Holder)
vHolder.Name = v.Name
v.CharacterAdded:Connect(function()
pcall(LoadCharacter, v)
end)
v.CharacterRemoving:Connect(function()
pcall(UnloadCharacter, v)
end)
LoadCharacter(v)
end
local UnloadPlayer = function(v)
UnloadCharacter(v)
local vHolder = Holder:FindFirstChild(v.Name)
if vHolder then
vHolder:Destroy()
end
end
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
spawn(function() pcall(LoadPlayer, v) end)
end
game:GetService("Players").PlayerAdded:Connect(function(v)
pcall(LoadPlayer, v)
end)
game:GetService("Players").PlayerRemoving:Connect(function(v)
pcall(UnloadPlayer, v)
end)
game.ItemChanged:Connect(function(i, v)
if i:IsA("Player") and v == "TeamColor" then
if Holder:FindFirstChild(i.Name) then
pcall(UnloadCharacter, i)
wait()
pcall(LoadCharacter, i)
end
elseif i:IsA("Humanoid") and i.Parent then
local p = game:GetService("Players"):GetPlayerFromCharacter(i.Parent)
if p and Holder:FindFirstChild(p.Name) and UpdateFuncs[p] then
UpdateFuncs[p]()
end
end
end)
game:GetService("Players").LocalPlayer.NameDisplayDistance = 0
game:GetService("Players").LocalPlayer.HealthDisplayDistance = 0
--[[game:GetService("UserInputService").InputBegan:Connect(function(Input, Processed)
if (not Processed) then
if (Input.KeyCode == Enum.KeyCode.Insert) then
Holder.Parent = not Holder.Parent and game:GetService("CoreGui") or nil
end
end
end)]]