Advertisement
SigmaBoy456

Wall check aimbot ex #84 TweenService

Sep 1st, 2024
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local character = player.Character or player.CharacterAdded:Wait()
  3. local localroot = character:WaitForChild("HumanoidRootPart")
  4. local headCam = character:WaitForChild("Head")
  5. local ts = game:GetService("TweenService")
  6. local Cam = workspace.CurrentCamera
  7.  
  8. local function closest()
  9. local target = nil
  10. local range = math.huge
  11. for _, v in pairs(game.Players:GetPlayers()) do
  12. if v ~= player and v.Character then
  13. local JN = v.Character:FindFirstChild("HumanoidRootPart")
  14. if JN then
  15. local dist = (localroot.Position - JN.Position).magnitude
  16. if dist < range then
  17. range = dist
  18. target = v
  19. end
  20. end
  21. end
  22. end
  23. return target
  24. end
  25.  
  26. local function Non_Behind_Wall_Target()
  27. local t = closest()
  28. if t and t.Character then
  29. local vroot = t.Character:FindFirstChild("HumanoidRootPart")
  30. local vhumanoid = t.Character:FindFirstChildOfClass("Humanoid")
  31. if vroot and vhumanoid and vhumanoid.Health > 0 then
  32. local direction = (vroot.Position - headCam.Position).unit * 1000
  33. local Ray_setting = RaycastParams.new()
  34. Ray_setting.FilterDescendantsInstances = {character}
  35. Ray_setting.FilterType = Enum.RaycastFilterType.Blacklist
  36. local result = workspace:Raycast(headCam.Position, direction, Ray_setting)
  37. if result and result.Instance:IsDescendantOf(t.Character) then
  38. return vroot
  39. end
  40. end
  41. end
  42. return nil
  43. end
  44.  
  45. while wait() do
  46. local t = Non_Behind_Wall_Target()
  47. if t then
  48. local tween = ts:Create(Cam, TweenInfo.new(0.25), {CFrame = CFrame.new(Cam.CFrame.Position, t.Position)})
  49. tween:Play()
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement