Advertisement
Guest User

FPS gui v1

a guest
Apr 25th, 2019
18,013
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.20 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. local plrsforaim = {}
  25.  
  26. local lplr = game:GetService("Players").LocalPlayer
  27. Move.Draggable = true
  28.  
  29.  
  30. f = {}
  31. local espforlder
  32.  
  33. f.addesp = function()
  34. --print("ESP ran")
  35. if espforlder then
  36. else
  37. espforlder = Instance.new("Folder")
  38. espforlder.Parent = game.Workspace.CurrentCamera
  39. end
  40. for i, v in pairs(espforlder:GetChildren()) do
  41. v:Destroy()
  42. end
  43. for _, plr in pairs(plrs:GetChildren()) do
  44. if plr.Character and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name then
  45. if TeamBased == true then
  46. if plr.Team.Name ~= plrs.LocalPlayer.Team.Name then
  47. local e = espforlder:FindFirstChild(plr.Name)
  48. if not e then
  49. --print("Added esp for team based")
  50. local bill = Instance.new("BillboardGui", espforlder)
  51. bill.Name = plr.Name
  52. bill.AlwaysOnTop = true
  53. bill.Size = UDim2.new(1,0,1,0)
  54. bill.Adornee = plr.Character.Head
  55. local Frame = Instance.new('Frame',bill)
  56. Frame.Active = true
  57. Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  58. Frame.BackgroundTransparency = 0
  59. Frame.BorderSizePixel = 0
  60. Frame.AnchorPoint = Vector2.new(.5, .5)
  61. Frame.Position = UDim2.new (0.5,0,0.5,0)
  62. Frame.Size = UDim2.new (1,0,1,0)
  63. Frame.Rotation = 0
  64. plr.Character.Humanoid.Died:Connect(function()
  65. bill:Destroy()
  66. end)
  67. end
  68. end
  69. else
  70. local e = espforlder:FindFirstChild(plr.Name)
  71. if not e then
  72. --print("Added esp")
  73. local bill = Instance.new("BillboardGui", espforlder)
  74. bill.Name = plr.Name
  75. bill.AlwaysOnTop = true
  76. bill.Size = UDim2.new(1,0,1,0)
  77. bill.Adornee = plr.Character.Head
  78. local Frame = Instance.new('Frame',bill)
  79. Frame.Active = true
  80. Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  81. Frame.BackgroundTransparency = 0
  82. Frame.BorderSizePixel = 0
  83. Frame.AnchorPoint = Vector2.new(.5, .5)
  84. Frame.Position = UDim2.new (0.5,0,0.5,0)
  85. Frame.Size = UDim2.new (1,0,1,0)
  86. Frame.Rotation = 0
  87. plr.Character.Humanoid.Died:Connect(function()
  88. bill:Destroy()
  89. end)
  90. end
  91. end
  92.  
  93.  
  94. end
  95. end
  96. end
  97. local cam = game.Workspace.CurrentCamera
  98.  
  99. local mouse = lplr:GetMouse()
  100. local switch = false
  101. local key = "k"
  102. local aimatpart = nil
  103. mouse.KeyDown:Connect(function(a)
  104. if a == "t" then
  105. --[[
  106. print("worked1")
  107. f.addesp()
  108. --]]
  109. elseif a == "u" then
  110. if raycast == true then
  111. raycast = false
  112. else
  113. raycast = true
  114. end
  115. elseif a == "l" then
  116. --[[
  117. if autoesp == false then
  118. autoesp = true
  119. else
  120. autoesp = false
  121. end
  122. end
  123. --]]
  124. if a == "j" then
  125. if mouse.Target then
  126. mouse.Target:Destroy()
  127. end
  128. end
  129. if a == key then
  130. if switch == false then
  131. switch = true
  132. else
  133. switch = false
  134. if aimatpart ~= nil then
  135. aimatpart = nil
  136. end
  137. end
  138. elseif a == teambasedswitch then
  139. if TeamBased == true then
  140. TeamBased = false
  141. teambasedstatus.Text = tostring(TeamBased)
  142. else
  143. TeamBased = true
  144. teambasedstatus.Text = tostring(TeamBased)
  145. end
  146. elseif a == aimkey then
  147. if not aimatpart then
  148. local maxangle = math.rad(20)
  149. for i, plr in pairs(plrs:GetChildren()) do
  150. if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  151. if TeamBased == true then
  152. if plr.Team.Name ~= lplr.Team.Name then
  153. local an = checkfov(plr.Character.Head)
  154. if an < maxangle then
  155. maxangle = an
  156. aimatpart = plr.Character.Head
  157. end
  158. end
  159. else
  160. local an = checkfov(plr.Character.Head)
  161. if an < maxangle then
  162. maxangle = an
  163. aimatpart = plr.Character.Head
  164. end
  165. print(plr)
  166. end
  167. plr.Character.Humanoid.Died:Connect(function()
  168. if aimatpart.Parent == plr.Character or aimatpart == nil then
  169. aimatpart = nil
  170. end
  171. end)
  172. end
  173. end
  174. else
  175. aimatpart = nil
  176. end
  177. end
  178. end)
  179.  
  180. function getfovxyz (p0, p1, deg)
  181. local x1, y1, z1 = p0:ToOrientation()
  182. local cf = CFrame.new(p0.p, p1.p)
  183. local x2, y2, z2 = cf:ToOrientation()
  184. --local d = math.deg
  185. if deg then
  186. --return Vector3.new(d(x1-x2), d(y1-y2), d(z1-z2))
  187. else
  188. return Vector3.new((x1-x2), (y1-y2), (z1-z2))
  189. end
  190. end
  191.  
  192. function getaimbotplrs()
  193. plrsforaim = {}
  194. for i, plr in pairs(plrs:GetChildren()) do
  195. if plr.Character and plr.Character.Humanoid and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name and plr.Character.Head then
  196.  
  197. if TeamBased == true then
  198. if plr.Team.Name ~= lplr.Team.Name then
  199. local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  200. local r = Ray.new(cf, cf.LookVector * 10000)
  201. local ign = {}
  202. for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  203. if v:IsA("BasePart") then
  204. table.insert(ign , v)
  205. end
  206. end
  207. local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  208. if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  209. table.insert(plrsforaim, obj)
  210. end
  211. end
  212. else
  213. local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  214. local r = Ray.new(cf, cf.LookVector * 10000)
  215. local ign = {}
  216. for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  217. if v:IsA("BasePart") then
  218. table.insert(ign , v)
  219. end
  220. end
  221. local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  222. if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  223. table.insert(plrsforaim, obj)
  224. end
  225. end
  226.  
  227.  
  228. end
  229. end
  230. end
  231.  
  232. function aimat(part)
  233. cam.CFrame = CFrame.new(cam.CFrame.p, part.CFrame.p)
  234. end
  235. function checkfov (part)
  236. local fov = getfovxyz(game.Workspace.CurrentCamera.CFrame, part.CFrame)
  237. local angle = math.abs(fov.X) + math.abs(fov.Y)
  238. return angle
  239. end
  240.  
  241. game:GetService("RunService").RenderStepped:Connect(function()
  242. if aimatpart then
  243. aimat(aimatpart)
  244. if aimatpart.Parent == plrs.LocalPlayer.Character then
  245. aimatpart = nil
  246. end
  247. end
  248.  
  249.  
  250. -- if switch == true then
  251. -- local maxangle = 99999
  252. --
  253. -- --print("Loop")
  254. -- if true and raycast == false then
  255. -- for i, plr in pairs(plrs:GetChildren()) do
  256. -- if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  257. -- if TeamBased then
  258. -- if plr.Team.Name ~= lplr.Team.Name or plr.Team.TeamColor ~= lplr.Team.TeamColor then
  259. -- local an = checkfov(plr.Character.Head)
  260. -- if an < maxangle then
  261. -- maxangle = an
  262. -- aimatpart = plr.Character.Head
  263. -- if an < lockangle then
  264. -- break
  265. -- end
  266. -- end
  267. -- end
  268. -- else
  269. -- local an = checkfov(plr.Character.Head)
  270. -- if an < maxangle then
  271. -- maxangle = an
  272. -- aimatpart = plr.Character.Head
  273. -- if an < lockangle then
  274. -- break
  275. -- end
  276. -- end
  277. -- end
  278. --
  279. --
  280. --
  281. --
  282. -- end
  283. -- end
  284. -- elseif raycast == true then
  285. --
  286. -- end
  287.  
  288. if raycast == true and switch == false and not aimatpart then
  289. getaimbotplrs()
  290. aimatpart = nil
  291. local maxangle = 999
  292. for i, v in ipairs(plrsforaim) do
  293. if v.Parent ~= lplr.Character then
  294. local an = checkfov(v)
  295. if an < maxangle and v ~= lplr.Character.Head then
  296. maxangle = an
  297. aimatpart = v
  298. print(v:GetFullName())
  299. v.Parent.Humanoid.Died:connect(function()
  300. aimatpart = nil
  301. end)
  302. end
  303. end
  304. end
  305.  
  306. end
  307. end)
  308. delay(0, function()
  309. while wait(espupdatetime) do
  310. if autoesp == true then
  311. pcall(function()
  312. f.addesp()
  313. end)
  314. end
  315. end
  316. end)
  317. warn("loaded")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement