View difference between Paste ID: gndexYtK and cKfE179z
SHOW: | | - or go back to the newest paste.
1
--[[	
2
  /$$$$$$                                 /$$$$$$                     /$$             /$$                      /$$   /$$
3
 /$$__  $$                               /$$__  $$                   |__/            | $$                     | $$  | $$
4
| $$  \__/  /$$$$$$$  /$$$$$$   /$$$$$$ | $$  \ $$  /$$$$$$$ /$$$$$$$ /$$  /$$$$$$$ /$$$$$$         /$$    /$$| $$  | $$
5
|  $$$$$$  /$$_____/ |____  $$ /$$__  $$| $$$$$$$$ /$$_____//$$_____/| $$ /$$_____/|_  $$_/        |  $$  /$$/| $$$$$$$$
6
 \____  $$| $$        /$$$$$$$| $$  \ $$| $$__  $$|  $$$$$$|  $$$$$$ | $$|  $$$$$$   | $$           \  $$/$$/ |_____  $$
7
 /$$  \ $$| $$       /$$__  $$| $$  | $$| $$  | $$ \____  $$\____  $$| $$ \____  $$  | $$ /$$        \  $$$/        | $$
8
|  $$$$$$/|  $$$$$$$|  $$$$$$$| $$$$$$$/| $$  | $$ /$$$$$$$//$$$$$$$/| $$ /$$$$$$$/  |  $$$$/         \  $/         | $$
9
 \______/  \_______/ \_______/| $$____/ |__/  |__/|_______/|_______/ |__/|_______/    \___/            \_/          |__/
10
                              | $$                                                                                      
11
                              | $$                                                                                      
12
                              |__/                                                                                      
13
]]--
14
15
--These can be edited--
16
local toggable = {
17
	target = "Head",
18
	walls = false,
19
	chams = true,
20
	ffa = false,
21
	auto = false,
22
	triggerbot = false,
23
	enabled = true
24
}
25
--These can be edited--
26
27
--Hotkeys--
28
local keys = {
29
	target = Enum.KeyCode.F,
30
	walls = Enum.KeyCode.P,
31
	chams = Enum.KeyCode.H,
32
	ffa = Enum.KeyCode.K,
33
	auto = Enum.KeyCode.L,
34
	tiggerbot = Enum.KeyCode.V,
35
	enabled = Enum.KeyCode.E
36
}
37
--Hotkeys--
38
39
--These can not--
40-
local players = game:GetService("Players")
40+
local lp = game.Players.LocalPlayer
41-
local workspace = game:GetService("Workspace")
41+
42-
local lp = players.LocalPlayer
42+
43
local camera = game.Workspace.CurrentCamera
44
local mouse = lp:GetMouse()
45-
local camera = workspace.CurrentCamera
45+
46
local chams = Instance.new("Folder")
47
chams.Name = "ScapChams"
48
chams.Parent = game.CoreGui
49
--These can not--
50
51
--Functions--
52
function checkWalls(pos)
53
	if pos.Parent:FindFirstChild("HumanoidRootPart") and pos and lpc:FindFirstChild(toggable.target) then
54
		local hit = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(lpc.HumanoidRootPart.CFrame.p, (pos.Parent.HumanoidRootPart.CFrame.p-lpc.HumanoidRootPart.CFrame.p).unit*500), {camera, lpc, chams}, false, true)
55
56-
		local hit = workspace:FindPartOnRayWithIgnoreList(Ray.new(lpc.HumanoidRootPart.CFrame.p, (pos.Parent.HumanoidRootPart.CFrame.p-lpc.HumanoidRootPart.CFrame.p).unit*500), {camera, lpc, chams}, false, true)
56+
57
			return true
58
		end	
59
		
60
		return false
61
	end
62
end
63
64
function getReturn(v)
65
	if v ~= "none" then
66
		
67
		if v.Character:FindFirstChild(toggable.target) then
68
			
69
			if toggable.walls and v.Character:FindFirstChild(toggable.target) and lpc:FindFirstChild("HumanoidRootPart") then
70
				return v.Character[toggable.target].CFrame.p
71
			elseif checkWalls(v.Character[toggable.target]) and v.Character:FindFirstChild(toggable.target) and lpc:FindFirstChild("HumanoidRootPart") then
72
				return v.Character[toggable.target].CFrame.p
73
			end
74
		end
75
	
76
	end
77
end
78
79
function grabClosest()
80
	local mini = 21e8
81
	local closest = "none"
82
	
83
	for _,v in pairs(game.Players:GetChildren()) do
84
		if v.Name ~= lp.Name and lpc:FindFirstChild("HumanoidRootPart") and v.Character and v.Character:FindFirstChild("HumanoidRootPart") then
85-
	for _,v in pairs(players:GetChildren()) do
85+
86
			if not toggable.walls and toggable.ffa and (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude < mini then
87
				
88
				if checkWalls(v.Character[toggable.target]) then
89
					mini = (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude
90
					closest = v
91
				end
92
			elseif not toggable.walls and (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude < mini and v.TeamColor ~= lp.TeamColor then
93
				
94
				if checkWalls(v.Character[toggable.target]) then
95
					mini = (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude
96
					closest = v
97
				end
98
			elseif toggable.ffa and (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude < mini then
99
				
100
				mini = (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude
101
				closest = v
102
			elseif (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude < mini and v.TeamColor ~= lp.TeamColor then
103
				
104
				mini = (lpc.HumanoidRootPart.CFrame.p-v.Character.HumanoidRootPart.CFrame.p).magnitude
105
				closest = v
106
			end	
107
		end
108
	end
109
	
110
	return getReturn(closest)
111
end
112
113
function grabColor(pos, plr)
114
	if toggable.ffa then
115
		return Color3.fromRGB(255, 0, 0)
116
	elseif plr.TeamColor == lp.TeamColor then
117
		return Color3.fromRGB(0, 255, 0)
118
	elseif plr.TeamColor ~= lp.TeamColor then
119
		return Color3.fromRGB(255, 0, 0)
120
	end
121
end
122
123
function createChams()
124
	chams:ClearAllChildren()
125
	
126
	for _,v in pairs(game.Players:GetChildren()) do
127
		if v.Name ~= lp.Name then
128-
	for _,v in pairs(players:GetChildren()) do
128+
129
			if v.Character then
130
				for _,c in pairs(v.Character:GetChildren()) do
131
					if c:IsA("BasePart") then
132
						local cham = Instance.new("BoxHandleAdornment")
133
						cham.Name = "Cham"
134
						cham.Color3 = grabColor(c, v)
135
						cham.Adornee = c
136
						cham.Size = c.Size+Vector3.new(0.01, 0.01, 0.01)
137
						cham.AlwaysOnTop = true
138
						cham.ZIndex = 1
139
						cham.Parent = chams
140
					end
141-
						cham.Parent = chamsz
141+
142
			end
143
			
144
		end
145
	end
146
end
147
--Functions--
148
149
--Main Framework--
150
game:GetService("RunService").RenderStepped:connect(function()
151
	if toggable.enabled and mdown or toggable.enabled and toggable.auto then
152
		local closest = grabClosest()
153
		
154
		if closest then
155
			game:GetService("TweenService"):Create(camera, TweenInfo.new(0.065, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {CFrame = CFrame.new(camera.Focus.p, closest)*CFrame.new(0, 0, 0.5)}):Play()
156
			if not toggable.walls and toggable.triggerbot then
157
				mouse1press()
158
				wait()
159
				mouse1release()
160
			end
161
		end
162
	end
163
end)
164
165
game:GetService("UserInputService").InputBegan:connect(function(key)
166
	for i,v in pairs(keys) do
167
		if key.KeyCode == v then
168
			
169
			if type(toggable[i]) == "boolean" then
170
				toggable[i] = not toggable[i]
171
				
172
				if i == "chams" then
173
					if toggable[i] then
174
						createChams()
175
					else
176
						chams:ClearAllChildren()
177
					end
178
				end
179
			else
180
				if toggable[i] == "Head" then
181
					toggable[i] = "HumanoidRootPart"
182
				else
183
					toggable[i] = "Head"
184
				end
185
			end
186
			
187
		end
188
	end
189
end)
190
191
mouse.Button2Down:connect(function()
192
	mdown = true
193
end)
194
195
mouse.Button2Up:connect(function()
196
	mdown = false
197
end)
198
199
if toggable.chams then
200
	createChams()
201
end
202
203
game.Players.LocalPlayer.CharacterAdded:connect(function(char)
204
	wait(0.25)
205-
players.LocalPlayer.CharacterAdded:connect(function(char)
205+
206
	lpc = char
207
	
208
	if toggable.chams then
209
		createChams()
210
	end
211
end)
212
--Main Framework--