jjsnappy

Roblox Counter Blox script (aimbot,esp)

Feb 14th, 2023
2,118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.62 KB | None | 0 0
  1. local plrs = game:GetService("Players")
  2. local TeamBased = true ; local teambasedswitch = "o"
  3. local presskeytoaim = true; local aimkey = "e"
  4. local raycast = false
  5.  
  6. local espupdatetime = 5; autoesp = false
  7.  
  8.  
  9.  
  10. local lockaim = true; local lockangle = 5
  11.  
  12.  
  13.  
  14. --function findwat(folder, what)
  15. -- for i, smth in pairs(folder:GetChildren()) do
  16. -- if string.find(string.lower(tostring(smth)), string.lower(what)) then
  17. -- return smth
  18. -- end
  19. -- end
  20. --end
  21. --
  22. --local plrs = findwat(game, "Players")
  23.  
  24.  
  25.  
  26.  
  27. local Gui = Instance.new("ScreenGui")
  28. local Move = Instance.new("Frame")
  29. local Main = Instance.new("Frame")
  30. local EspStatus = Instance.new("TextLabel")
  31. local st1 = Instance.new("TextLabel")
  32. local st1_2 = Instance.new("TextLabel")
  33. local st1_3 = Instance.new("TextLabel")
  34. local Name = Instance.new("TextLabel")
  35. --Properties:
  36. Gui.Name = "Gui"
  37. Gui.Parent = plrs.LocalPlayer:WaitForChild("PlayerGui")
  38.  
  39. Move.Name = "Move"
  40. Move.Parent = Gui
  41. Move.BackgroundColor3 = Color3.new(0.0431373, 1, 0.0745098)
  42. Move.BackgroundTransparency = 0.40000000596046
  43. Move.BorderSizePixel = 0
  44. Move.Position = UDim2.new(0.005, 0,0.018, 0)
  45. Move.Size = UDim2.new(0.28141585, 0, 0.0320388414, 0)
  46.  
  47. Main.Name = "Main"
  48. Main.Parent = Move
  49. Main.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  50. Main.BackgroundTransparency = 0.69999998807907
  51. Main.Position = UDim2.new(0, 0, 0.995670795, 0)
  52. Main.Size = UDim2.new(1.0000006, 0, 9.79697132, 0)
  53.  
  54. EspStatus.Name = "EspStatus"
  55. EspStatus.Parent = Main
  56. EspStatus.BackgroundColor3 = Color3.new(1, 1, 1)
  57. EspStatus.BackgroundTransparency = 1
  58. EspStatus.Size = UDim2.new(0.272955924, 0, 0.161862016, 0)
  59. EspStatus.Font = Enum.Font.ArialBold
  60. EspStatus.Text = "Press T to update Esp"
  61. EspStatus.TextColor3 = Color3.new(0.0431373, 1, 0.0745098)
  62. EspStatus.TextScaled = true
  63. EspStatus.TextSize = 14
  64. EspStatus.TextWrapped = true
  65.  
  66. st1.Name = "st1"
  67. st1.Parent = Main
  68. st1.BackgroundColor3 = Color3.new(1, 1, 1)
  69. st1.BackgroundTransparency = 1
  70. st1.Position = UDim2.new(0.271787882, 0, 0, 0)
  71. st1.Size = UDim2.new(0.728211343, 0, 0.161862016, 0)
  72. st1.Font = Enum.Font.ArialBold
  73. st1.Text = "Press "..aimkey.." to lock on a person inside ur view"
  74. st1.TextColor3 = Color3.new(0.0431373, 1, 0.0745098)
  75. st1.TextScaled = true
  76. st1.TextSize = 14
  77. st1.TextWrapped = true
  78.  
  79. st1_2.Name = "st1"
  80. st1_2.Parent = Main
  81. st1_2.BackgroundColor3 = Color3.new(1, 1, 1)
  82. st1_2.BackgroundTransparency = 1
  83. st1_2.Position = UDim2.new(0, 0, 0.375590861, 0)
  84. st1_2.Size = UDim2.new(0.999999881, 0, 0.161862016, 0)
  85. st1_2.Font = Enum.Font.ArialBold
  86. st1_2.Text = "Press L to enable esp loop"
  87. st1_2.TextColor3 = Color3.new(0.0431373, 1, 0.0745098)
  88. st1_2.TextScaled = true
  89. st1_2.TextSize = 14
  90. st1_2.TextWrapped = true
  91.  
  92. st1_3.Name = "st1"
  93. st1_3.Parent = Main
  94. st1_3.BackgroundColor3 = Color3.new(1, 1, 1)
  95. st1_3.BackgroundTransparency = 1
  96. st1_3.Position = UDim2.new(0, 0, 0.18558608, 0)
  97. st1_3.Size = UDim2.new(0.999999881, 0, 0.161862016, 0)
  98. st1_3.Font = Enum.Font.ArialBold
  99. st1_3.Text = "Press O to change team based mode"
  100. st1_3.TextColor3 = Color3.new(0.0431373, 1, 0.0745098)
  101. st1_3.TextScaled = true
  102. st1_3.TextSize = 14
  103. st1_3.TextWrapped = true
  104. local teambasedstatus = st1_3:Clone()
  105. teambasedstatus.Parent = st1_3
  106. teambasedstatus.TextScaled = true
  107. teambasedstatus.Position = UDim2.new(0, 0,0.694, 0)
  108. teambasedstatus.Text = tostring(TeamBased)
  109.  
  110. Name.Name = "Name"
  111. Name.Parent = Move
  112. Name.BackgroundColor3 = Color3.new(1, 1, 1)
  113. Name.BackgroundTransparency = 1
  114. Name.Size = UDim2.new(0.838, 0, 0.980000019, 0)
  115. Name.Font = Enum.Font.Arial
  116. Name.Text = "FPS gui v1.0"
  117. Name.TextColor3 = Color3.new(0, 0, 0)
  118. Name.TextScaled = true
  119. Name.TextSize = 14
  120. Name.TextWrapped = true
  121. Name.TextXAlignment = Enum.TextXAlignment.Left
  122. -- Scripts:
  123.  
  124.  
  125. local plrsforaim = {}
  126.  
  127. local lplr = game:GetService("Players").LocalPlayer
  128. Move.Draggable = true
  129. Gui.ResetOnSpawn = false
  130. Gui.Name = "Chat"
  131. Gui.DisplayOrder = 999
  132.  
  133. Gui.Parent = plrs.LocalPlayer.PlayerGui
  134.  
  135.  
  136. f = {}
  137. local espforlder
  138.  
  139. f.addesp = function()
  140. --print("ESP ran")
  141. if espforlder then
  142. else
  143. espforlder = Instance.new("Folder")
  144. espforlder.Parent = game.Workspace.CurrentCamera
  145. end
  146. for i, v in pairs(espforlder:GetChildren()) do
  147. v:Destroy()
  148. end
  149. for _, plr in pairs(plrs:GetChildren()) do
  150. if plr.Character and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name then
  151. if TeamBased == true then
  152. if plr.Team.Name ~= plrs.LocalPlayer.Team.Name then
  153. local e = espforlder:FindFirstChild(plr.Name)
  154. if not e then
  155. --print("Added esp for team based")
  156. local bill = Instance.new("BillboardGui", espforlder)
  157. bill.Name = plr.Name
  158. bill.AlwaysOnTop = true
  159. bill.Size = UDim2.new(1,0,1,0)
  160. bill.Adornee = plr.Character.Head
  161. local Frame = Instance.new('Frame',bill)
  162. Frame.Active = true
  163. Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  164. Frame.BackgroundTransparency = 0
  165. Frame.BorderSizePixel = 0
  166. Frame.AnchorPoint = Vector2.new(.5, .5)
  167. Frame.Position = UDim2.new (0.5,0,0.5,0)
  168. Frame.Size = UDim2.new (1,0,1,0)
  169. Frame.Rotation = 0
  170. plr.Character.Humanoid.Died:Connect(function()
  171. bill:Destroy()
  172. end)
  173. end
  174. end
  175. else
  176. local e = espforlder:FindFirstChild(plr.Name)
  177. if not e then
  178. --print("Added esp")
  179. local bill = Instance.new("BillboardGui", espforlder)
  180. bill.Name = plr.Name
  181. bill.AlwaysOnTop = true
  182. bill.Size = UDim2.new(1,0,1,0)
  183. bill.Adornee = plr.Character.Head
  184. local Frame = Instance.new('Frame',bill)
  185. Frame.Active = true
  186. Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  187. Frame.BackgroundTransparency = 0
  188. Frame.BorderSizePixel = 0
  189. Frame.AnchorPoint = Vector2.new(.5, .5)
  190. Frame.Position = UDim2.new (0.5,0,0.5,0)
  191. Frame.Size = UDim2.new (1,0,1,0)
  192. Frame.Rotation = 0
  193. plr.Character.Humanoid.Died:Connect(function()
  194. bill:Destroy()
  195. end)
  196. end
  197. end
  198.  
  199.  
  200. end
  201. end
  202. end
  203. local cam = game.Workspace.CurrentCamera
  204.  
  205. local mouse = lplr:GetMouse()
  206. local switch = false
  207. local key = "k"
  208. local aimatpart = nil
  209. mouse.KeyDown:Connect(function(a)
  210. if a == "t" then
  211. print("worked1")
  212. f.addesp()
  213. elseif a == "u" then
  214. if raycast == true then
  215. raycast = false
  216. else
  217. raycast = true
  218. end
  219. elseif a == "l" then
  220. if autoesp == false then
  221. autoesp = true
  222. else
  223. autoesp = false
  224. end
  225. end
  226. if a == "j" then
  227. if mouse.Target then
  228. mouse.Target:Destroy()
  229. end
  230. end
  231. if a == key then
  232. if switch == false then
  233. switch = true
  234. else
  235. switch = false
  236. if aimatpart ~= nil then
  237. aimatpart = nil
  238. end
  239. end
  240. elseif a == teambasedswitch then
  241. if TeamBased == true then
  242. TeamBased = false
  243. teambasedstatus.Text = tostring(TeamBased)
  244. else
  245. TeamBased = true
  246. teambasedstatus.Text = tostring(TeamBased)
  247. end
  248. elseif a == aimkey then
  249. if not aimatpart then
  250. local maxangle = math.rad(20)
  251. for i, plr in pairs(plrs:GetChildren()) do
  252. if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  253. if TeamBased == true then
  254. if plr.Team.Name ~= lplr.Team.Name then
  255. local an = checkfov(plr.Character.Head)
  256. if an < maxangle then
  257. maxangle = an
  258. aimatpart = plr.Character.Head
  259. end
  260. end
  261. else
  262. local an = checkfov(plr.Character.Head)
  263. if an < maxangle then
  264. maxangle = an
  265. aimatpart = plr.Character.Head
  266. end
  267. print(plr)
  268. end
  269. plr.Character.Humanoid.Died:Connect(function()
  270. if aimatpart.Parent == plr.Character or aimatpart == nil then
  271. aimatpart = nil
  272. end
  273. end)
  274. end
  275. end
  276. else
  277. aimatpart = nil
  278. end
  279. end
  280. end)
  281.  
  282. function getfovxyz (p0, p1, deg)
  283. local x1, y1, z1 = p0:ToOrientation()
  284. local cf = CFrame.new(p0.p, p1.p)
  285. local x2, y2, z2 = cf:ToOrientation()
  286. --local d = math.deg
  287. if deg then
  288. --return Vector3.new(d(x1-x2), d(y1-y2), d(z1-z2))
  289. else
  290. return Vector3.new((x1-x2), (y1-y2), (z1-z2))
  291. end
  292. end
  293.  
  294. function getaimbotplrs()
  295. plrsforaim = {}
  296. for i, plr in pairs(plrs:GetChildren()) do
  297. if plr.Character and plr.Character.Humanoid and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name and plr.Character.Head then
  298.  
  299. if TeamBased == true then
  300. if plr.Team.Name ~= lplr.Team.Name then
  301. local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  302. local r = Ray.new(cf, cf.LookVector * 10000)
  303. local ign = {}
  304. for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  305. if v:IsA("BasePart") then
  306. table.insert(ign , v)
  307. end
  308. end
  309. local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  310. if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  311. table.insert(plrsforaim, obj)
  312. end
  313. end
  314. else
  315. local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  316. local r = Ray.new(cf, cf.LookVector * 10000)
  317. local ign = {}
  318. for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  319. if v:IsA("BasePart") then
  320. table.insert(ign , v)
  321. end
  322. end
  323. local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  324. if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  325. table.insert(plrsforaim, obj)
  326. end
  327. end
  328.  
  329.  
  330. end
  331. end
  332. end
  333.  
  334. function aimat(part)
  335. cam.CFrame = CFrame.new(cam.CFrame.p, part.CFrame.p)
  336. end
  337. function checkfov (part)
  338. local fov = getfovxyz(game.Workspace.CurrentCamera.CFrame, part.CFrame)
  339. local angle = math.abs(fov.X) + math.abs(fov.Y)
  340. return angle
  341. end
  342.  
  343. game:GetService("RunService").RenderStepped:Connect(function()
  344. if aimatpart then
  345. aimat(aimatpart)
  346. if aimatpart.Parent == plrs.LocalPlayer.Character then
  347. aimatpart = nil
  348. end
  349. end
  350.  
  351.  
  352. -- if switch == true then
  353. -- local maxangle = 99999
  354. --
  355. -- --print("Loop")
  356. -- if true and raycast == false then
  357. -- for i, plr in pairs(plrs:GetChildren()) do
  358. -- if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  359. -- if TeamBased then
  360. -- if plr.Team.Name ~= lplr.Team.Name or plr.Team.TeamColor ~= lplr.Team.TeamColor then
  361. -- local an = checkfov(plr.Character.Head)
  362. -- if an < maxangle then
  363. -- maxangle = an
  364. -- aimatpart = plr.Character.Head
  365. -- if an < lockangle then
  366. -- break
  367. -- end
  368. -- end
  369. -- end
  370. -- else
  371. -- local an = checkfov(plr.Character.Head)
  372. -- if an < maxangle then
  373. -- maxangle = an
  374. -- aimatpart = plr.Character.Head
  375. -- if an < lockangle then
  376. -- break
  377. -- end
  378. -- end
  379. -- end
  380. --
  381. --
  382. --
  383. --
  384. -- end
  385. -- end
  386. -- elseif raycast == true then
  387. --
  388. -- end
  389.  
  390. if raycast == true and switch == false and not aimatpart then
  391. getaimbotplrs()
  392. aimatpart = nil
  393. local maxangle = 999
  394. for i, v in ipairs(plrsforaim) do
  395. if v.Parent ~= lplr.Character then
  396. local an = checkfov(v)
  397. if an < maxangle and v ~= lplr.Character.Head then
  398. maxangle = an
  399. aimatpart = v
  400. print(v:GetFullName())
  401. v.Parent.Humanoid.Died:connect(function()
  402. aimatpart = nil
  403. end)
  404. end
  405. end
  406. end
  407.  
  408. end
  409. end)
  410. delay(0, function()
  411. while wait(espupdatetime) do
  412. if autoesp == true then
  413. pcall(function()
  414. f.addesp()
  415. end)
  416. end
  417. end
  418. end)
  419.  
Add Comment
Please, Sign In to add comment