Advertisement
yugeoz

Phantom Forces Silent Aim Script

Mar 1st, 2024
4,774
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.34 KB | None | 0 0
  1. local scriptSource = [[
  2. local silentaim = {
  3. enabled = true,
  4. fovEnabled = true,
  5. fovSize = 500,
  6. fovCircleEnabled = true,
  7. fovCircleColor = Color3.fromRGB(255, 255, 255),
  8. hitPercent = 100,
  9. headShotPercent = 100
  10. }
  11. local enemyesp = {
  12. boxCorners = true,
  13. boxLineSize = 0.33, -- 0.5 max
  14. boxColor = Color3.fromRGB(255, 99, 99),
  15. boxCornerOutline = true,
  16. names = true,
  17. nameSize = 12,
  18. nameOffset = 6,
  19. nameColor = Color3.fromRGB(255, 255, 255),
  20. nameOutline = true,
  21. healthBars = true,
  22. healthBarOffset = -5,
  23. healthBarThickness = 2,
  24. healthBarOutline = true,
  25. skeleton = true,
  26. skeletonThickness = 1,
  27. skeletonColor = Color3.fromRGB(255, 255, 255)
  28. }
  29.  
  30. local requireModule
  31. for i, v in next, getgc(false) do
  32. if type(v) == "function" and debug.getinfo(v).name == "require" and islclosure(v) then
  33. requireModule = v
  34. break
  35. end
  36. end
  37.  
  38. local publicSettings = requireModule("PublicSettings")
  39. local replication = requireModule("ReplicationInterface")
  40. local bulletObject = requireModule("BulletObject")
  41. local network = requireModule("NetworkClient")
  42.  
  43. local runService = game:GetService("RunService")
  44. local workspace = game:GetService("Workspace")
  45. local players = game:GetService("Players")
  46.  
  47. local currentCamera = workspace.CurrentCamera
  48. local localplayer = players.LocalPlayer
  49. local ignore = workspace.Ignore
  50. local new = bulletObject.new
  51. local zero = Vector3.zero
  52. local send = network.send
  53. local dot = zero.Dot
  54.  
  55. local espData = {}
  56. local healthbarData = game:HttpGet("https://i.imgur.com/FpnD6XG.png")
  57. local defaultProperties = {
  58. Thickness = 1,
  59. Filled = false,
  60. Transparency = 1,
  61. Outline = false,
  62. Center = true,
  63. Visible = false
  64. }
  65.  
  66. local fovCircle = Drawing.new("Circle")
  67. fovCircle.Position = currentCamera.ViewportSize * 0.5
  68. fovCircle.Visible = silentaim.fovCircleEnabled
  69. fovCircle.Color = silentaim.fovCircleColor
  70. fovCircle.Radius = silentaim.fovSize
  71. fovCircle.Transparency = 1
  72. fovCircle.Filled = false
  73. fovCircle.NumSides = 32
  74.  
  75. local function getClosest(partName, fov)
  76. local distance, position, closestPlayer, part = fov or math.huge, nil, nil, nil
  77. fovCircle.Position = currentCamera.ViewportSize * 0.5
  78.  
  79. replication.operateOnAllEntries(function(player, entry)
  80. local character = entry._thirdPersonObject and entry._thirdPersonObject._characterHash
  81.  
  82. if character and player.Team ~= localplayer.Team then
  83. local screenPosition, onscreen = currentCamera:WorldToViewportPoint(character[partName].Position)
  84. local screenDistance = (Vector2.new(screenPosition.X, screenPosition.Y) - fovCircle.Position).Magnitude
  85.  
  86. if screenPosition.Z > 0 and screenDistance < distance then
  87. part = character[partName]
  88. position = part.Position
  89. distance = screenDistance
  90. closestPlayer = entry
  91. end
  92. end
  93. end)
  94.  
  95. return position, closestPlayer, part
  96. end
  97.  
  98. local function trajectory(o, a, t, s, e)
  99. local f = -a
  100. local ld = t - o
  101. local a = dot(f, f)
  102. local b = 4 * dot(ld, ld)
  103. local k = (4 * (dot(f, ld) + s * s)) / (2 * a)
  104. local v = (k * k - b / a) ^ 0.5
  105. local t, t0 = k - v, k + v
  106.  
  107. t = t < 0 and t0 or t; t = t ^ 0.5
  108. return f * t / 2 + (e or zero) + ld / t, t
  109. end
  110.  
  111. local missChance
  112. local headChance
  113. function network:send(name, ...)
  114. if name == "newbullets" and silentaim.enabled and missChance <= silentaim.hitPercent then
  115. local position, entry, head = getClosest(headChance > silentaim.headShotPercent and "Torso" or "Head", silentaim.fovEnabled and silentaim.fovSize)
  116.  
  117. if position then
  118. local a, data, time, b = ...
  119. local velocity = trajectory(data.firepos, publicSettings.bulletAcceleration, position, data.bullets[1][1].Magnitude, entry._velspring.t)
  120.  
  121. for i = 1, #data.bullets do
  122. data.bullets[i][1] = velocity
  123. end
  124.  
  125. return send(self, name, a, data, time, b)
  126. end
  127. end
  128.  
  129. return send(self, name, ...)
  130. end
  131.  
  132. function bulletObject.new(data)
  133. if silentaim.enabled and data.onplayerhit and missChance <= silentaim.hitPercent then
  134. local position, entry, head = getClosest(headChance > silentaim.headShotPercent and "Torso" or "Head", silentaim.fovEnabled and silentaim.fovSize)
  135.  
  136. if position then
  137. data.velocity = trajectory(data.position, publicSettings.bulletAcceleration, position, data.velocity.Magnitude, entry._velspring.t)
  138. end
  139. end
  140.  
  141. return new(data)
  142. end
  143.  
  144. task.spawn(function()
  145. while task.wait(0.1) do
  146. missChance = math.random(1, 100)
  147. headChance = math.random(1, 100)
  148. end
  149. end)
  150.  
  151. function draw(shape)
  152. local drawing = Drawing.new(shape)
  153.  
  154. for i, v in pairs(defaultProperties) do
  155. pcall(function()
  156. drawing[i] = v
  157. end)
  158. end
  159.  
  160. return drawing
  161. end
  162.  
  163. function getSquarePositions(character)
  164. local top = currentCamera:WorldToViewportPoint(character.Head.Position + Vector3.yAxis)
  165. local middle = currentCamera:WorldToViewportPoint(character.Torso.Position)
  166. local left = currentCamera:WorldToViewportPoint(character["Left Arm"].Position)
  167. local right = currentCamera:WorldToViewportPoint(character["Right Arm"].Position)
  168.  
  169. local leftSize, rightSize
  170. if left.X < right.X then
  171. leftSize = "Left Arm"
  172. rightSize = "Right Arm"
  173. else
  174. leftSize = "Left Arm"
  175. rightSize = "Right Arm"
  176. end
  177.  
  178. left = currentCamera:WorldToViewportPoint(character[leftSize].Position - currentCamera.CFrame.RightVector)
  179. right = currentCamera:WorldToViewportPoint(character[leftSize].Position + currentCamera.CFrame.RightVector)
  180.  
  181. local size = Vector2.new(math.abs(left.X - right.X) * 2, (middle.Y - top.Y) * 2.2)
  182.  
  183. return Vector2.new(middle.X - size.X * 0.5, top.Y), size
  184. end
  185.  
  186. runService.Heartbeat:Connect(function()
  187. local alive = ignore:FindFirstChild("RefPlayer")
  188.  
  189. replication.operateOnAllEntries(function(player, entry)
  190. local data = espData[player]
  191.  
  192. if not data then
  193. data = {}
  194. data.visible = false
  195. data.entry = entry
  196. data.drawings = {
  197. line100 = draw("Line"),
  198. line101 = draw("Line"),
  199. line110 = draw("Line"),
  200. line111 = draw("Line"),
  201. line120 = draw("Line"),
  202. line121 = draw("Line"),
  203. line130 = draw("Line"),
  204. line131 = draw("Line"),
  205. line000 = draw("Line"),
  206. line001 = draw("Line"),
  207. line010 = draw("Line"),
  208. line011 = draw("Line"),
  209. line020 = draw("Line"),
  210. line021 = draw("Line"),
  211. line030 = draw("Line"),
  212. line031 = draw("Line"),
  213. name = draw("Text"),
  214. skeletonhead = draw("Line"),
  215. skeletonlarm = draw("Line"),
  216. skeletonrarm = draw("Line"),
  217. skeletonlleg = draw("Line"),
  218. skeletonrleg = draw("Line"),
  219. healthbaroutline = draw("Square"),
  220. healthbarimage = draw("Image"),
  221. healthbarsquare = draw("Square"),
  222. }
  223. for drawingName, drawing in next, data.drawings do
  224. if string.find(drawingName, "line1") then
  225. drawing.Thickness = 3
  226. drawing.Color = Color3.fromRGB(0, 0, 0)
  227. end
  228. end
  229. data.drawings.name.Text = player.Name
  230. data.drawings.healthbarsquare.Filled = true
  231. data.drawings.healthbaroutline.Filled = true
  232. data.drawings.healthbaroutline.Color = Color3.fromRGB(0, 0, 0)
  233. data.drawings.healthbarimage.Data = healthbarData
  234. data.drawings.healthbarimage.Visible = true
  235. data.setVisibility = function(visible)
  236. data.drawings.name.Visible = visible and enemyesp.names
  237. data.drawings.line000.Visible = visible and enemyesp.boxCorners
  238. data.drawings.line001.Visible = visible and enemyesp.boxCorners
  239. data.drawings.line010.Visible = visible and enemyesp.boxCorners
  240. data.drawings.line011.Visible = visible and enemyesp.boxCorners
  241. data.drawings.line020.Visible = visible and enemyesp.boxCorners
  242. data.drawings.line021.Visible = visible and enemyesp.boxCorners
  243. data.drawings.line030.Visible = visible and enemyesp.boxCorners
  244. data.drawings.line031.Visible = visible and enemyesp.boxCorners
  245. data.drawings.line100.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  246. data.drawings.line101.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  247. data.drawings.line110.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  248. data.drawings.line111.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  249. data.drawings.line120.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  250. data.drawings.line121.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  251. data.drawings.line130.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  252. data.drawings.line131.Visible = visible and enemyesp.boxCorners and enemyesp.boxCornerOutline
  253. data.drawings.skeletonhead.Visible = visible and enemyesp.skeleton
  254. data.drawings.skeletonlarm.Visible = visible and enemyesp.skeleton
  255. data.drawings.skeletonrarm.Visible = visible and enemyesp.skeleton
  256. data.drawings.skeletonlleg.Visible = visible and enemyesp.skeleton
  257. data.drawings.skeletonrleg.Visible = visible and enemyesp.skeleton
  258. data.drawings.healthbaroutline.Visible = visible and enemyesp.healthBars and enemyesp.healthBarOutline
  259. data.drawings.healthbarimage.Transparency = visible and enemyesp.healthBars and 1 or 0
  260. data.drawings.healthbarimage.Visible = visible and enemyesp.healthBars
  261. data.drawings.healthbarsquare.Visible = visible and enemyesp.healthBars
  262. data.visible = visible
  263. end
  264.  
  265. espData[player] = data
  266. end
  267.  
  268. if (not entry._alive and data.visible) or not alive then
  269. data.setVisibility(false)
  270. end
  271. end)
  272.  
  273. if alive and alive:FindFirstChild("HumanoidRootPart") then
  274. for player, data in next, espData do
  275. if data.entry._alive and data.entry._player.Team ~= players.LocalPlayer.Team then
  276. local character = data.entry._thirdPersonObject and data.entry._thirdPersonObject._characterHash
  277.  
  278. if character then
  279. local screenPosition, onScreen = currentCamera:WorldToViewportPoint(character.Head.Position)
  280.  
  281. if onScreen and screenPosition.Z > 0 then
  282. if not data.visible then
  283. data.setVisibility(true)
  284. end
  285.  
  286. local boxPosition, boxSize, middle
  287. if enemyesp.boxCorners or enemyesp.names or enemyesp.healthBars then
  288. boxPosition, boxSize = getSquarePositions(character)
  289. middle = boxPosition + boxSize * 0.5
  290. end
  291.  
  292. local p0, p1, p2, p3, sx, sy, p00, p01, p10, p11, p20, p21, p30, p31
  293. if enemyesp.boxCorners then
  294. sx, sy = Vector2.new(boxSize.X, 0), Vector2.new(0, boxSize.Y)
  295. p0, p1, p2, p3 = boxPosition, boxPosition + sx, boxPosition + sy, boxPosition + sx + sy
  296. sx, sy = sx * enemyesp.boxLineSize, sy * enemyesp.boxLineSize
  297. p00, p01, p10, p11, p20, p21, p30, p31 = p0 + sx, p0 + sy, p1 - sx, p1 + sy, p2 + sx, p2 - sy, p3 - sx, p3 - sy
  298.  
  299. data.drawings.line000.From = p0
  300. data.drawings.line001.From = p0
  301. data.drawings.line000.To = p00
  302. data.drawings.line001.To = p01
  303. data.drawings.line010.From = p1
  304. data.drawings.line011.From = p1
  305. data.drawings.line010.To = p10
  306. data.drawings.line011.To = p11
  307. data.drawings.line020.From = p2
  308. data.drawings.line021.From = p2
  309. data.drawings.line020.To = p20
  310. data.drawings.line021.To = p21
  311. data.drawings.line030.From = p3
  312. data.drawings.line031.From = p3
  313. data.drawings.line030.To = p30
  314. data.drawings.line031.To = p31
  315.  
  316. for drawingName, drawing in next, data.drawings do
  317. if string.find(drawingName, "line0") then
  318. drawing.Color = enemyesp.boxColor
  319. end
  320. end
  321. end
  322.  
  323. if data.drawings.line100.Visible then
  324. data.drawings.line100.From = p0
  325. data.drawings.line101.From = p0
  326. data.drawings.line100.To = p00
  327. data.drawings.line101.To = p01
  328. data.drawings.line110.From = p1
  329. data.drawings.line111.From = p1
  330. data.drawings.line110.To = p10
  331. data.drawings.line111.To = p11
  332. data.drawings.line120.From = p2
  333. data.drawings.line121.From = p2
  334. data.drawings.line120.To = p20
  335. data.drawings.line121.To = p21
  336. data.drawings.line130.From = p3
  337. data.drawings.line131.From = p3
  338. data.drawings.line130.To = p30
  339. data.drawings.line131.To = p31
  340. end
  341.  
  342. if enemyesp.names then
  343. local name = data.drawings.name
  344. name.Position = Vector2.new(middle.X, boxPosition.Y + (enemyesp.nameOffset < 0 and boxSize.Y or 0) - enemyesp.nameOffset - enemyesp.nameSize * 0.5)
  345. name.Size = enemyesp.nameSize
  346. name.Color = enemyesp.nameColor
  347. name.Outline = enemyesp.nameOutline
  348. end
  349.  
  350. if enemyesp.healthBars then
  351. local healthbarimage = data.drawings.healthbarimage
  352. local healthbarsquare = data.drawings.healthbarsquare
  353. local health = (data.entry._healthstate.health0 ~= 0 and data.entry._healthstate.health0 or 100) * 0.01
  354. local squareSize = boxSize.Y * (1 - health)
  355. healthbarimage.Position = Vector2.new(boxPosition.X + (enemyesp.healthBarOffset > 0 and boxSize.X or 0) + enemyesp.healthBarOffset - enemyesp.healthBarThickness * 0.5, boxPosition.Y)
  356. healthbarimage.Size = Vector2.new(enemyesp.healthBarThickness, boxSize.Y)
  357. healthbarsquare.Position = healthbarimage.Position
  358. healthbarsquare.Size = Vector2.new(enemyesp.healthBarThickness, squareSize)
  359. end
  360.  
  361. if data.drawings.healthbaroutline.Visible then
  362. local healthbaroutline = data.drawings.healthbaroutline
  363. healthbaroutline.Position = data.drawings.healthbarimage.Position - Vector2.new(1, 1)
  364. healthbaroutline.Size = data.drawings.healthbarimage.Size + Vector2.new(2, 2)
  365. end
  366.  
  367. if enemyesp.skeleton then
  368. local rootPos = currentCamera:WorldToViewportPoint(character.Torso.Position)
  369. local larmPos = currentCamera:WorldToViewportPoint(character["Left Arm"].Position)
  370. local rarmPos = currentCamera:WorldToViewportPoint(character["Right Arm"].Position)
  371. local llegPos = currentCamera:WorldToViewportPoint(character["Left Leg"].Position)
  372. local rlegPos = currentCamera:WorldToViewportPoint(character["Right Leg"].Position)
  373.  
  374. local drawings = data.drawings
  375. drawings.skeletonhead.To = Vector2.new(screenPosition.X, screenPosition.Y)
  376. drawings.skeletonlarm.To = Vector2.new(larmPos.X, larmPos.Y)
  377. drawings.skeletonrarm.To = Vector2.new(rarmPos.X, rarmPos.Y)
  378. drawings.skeletonlleg.To = Vector2.new(llegPos.X, llegPos.Y)
  379. drawings.skeletonrleg.To = Vector2.new(rlegPos.X, rlegPos.Y)
  380.  
  381. local fromPos = Vector2.new(rootPos.X, rootPos.Y)
  382. for drawingName, drawing in next, drawings do
  383. if string.find(drawingName, "skeleton") then
  384. drawing.Thickness = enemyesp.skeletonThickness
  385. drawing.Color = enemyesp.skeletonColor
  386. drawing.From = fromPos
  387. end
  388. end
  389. end
  390. elseif data.visible then
  391. data.setVisibility(false)
  392. end
  393. end
  394. end
  395. end
  396. end
  397. end)
  398.  
  399. players.PlayerRemoving:Connect(function(player)
  400. player = espData[player]
  401.  
  402. if player then
  403. player.setVisibility(false)
  404.  
  405. for _, drawing in next, player.drawings do
  406. drawing:Remove()
  407. end
  408.  
  409. espData[player] = nil
  410. end
  411. end)
  412. ]]
  413.  
  414. local requireModule
  415. for i, v in next, getgc(false) do
  416. if type(v) == "function" and debug.getinfo(v).name == "require" and islclosure(v) then
  417. requireModule = v
  418. break
  419. end
  420. end
  421.  
  422. if requireModule then
  423. loadstring(scriptSource)()
  424. else
  425. queue_on_teleport("task.wait(5);" .. scriptSource)
  426. setfflag("DebugRunParallelLuaOnMainThread", "True")
  427. game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, game.JobId)
  428. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement