Advertisement
Honansik

Phantom Forces Script [Chams, Raycast, Open Source]

Dec 24th, 2021
13,949
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.37 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2.  
  3. local l_character = plr.Character or plr.CharacterAdded:wait()
  4. local f_team
  5. local e_team
  6. local e_plrlist
  7. local rs = game:GetService("RunService")
  8. local camera = workspace.CurrentCamera
  9. local pfId = 292439477
  10. local pId = game.PlaceId
  11. local is_pf = pfId == pId
  12.  
  13.  
  14. local function geteplrlist()
  15.   local t = {}
  16.    if is_pf then
  17.        local team_color_to_string = tostring(game.Players.LocalPlayer.TeamColor)
  18.            if team_color_to_string == "Bright orange" then
  19.                t = workspace.Players["Bright blue"]:GetChildren()
  20.            else
  21.                t = workspace.Players["Bright orange"]:GetChildren()
  22.            end
  23.    elseif not is_pf then
  24.        if #game.Teams:GetChildren() > 0 then
  25.            for i,v in next, game.Players:GetPlayers() do
  26.                if v.Team~=game.Players.LocalPlayer.Team then
  27.                    table.insert(t,v)
  28.                end
  29.            end
  30.        else
  31.            for i,v in next, game.Players:GetPlayers() do
  32.                if v ~= game.Players.LocalPlayer then
  33.                    table.insert(t,v)
  34.                    end
  35.                end
  36.            end
  37.        end
  38.    return t
  39. end
  40.  
  41. rs.Stepped:Connect(function()
  42. e_plrlist = geteplrlist()
  43. end)
  44.  
  45. local function check_for_esp(c_model)
  46.   if not c_model then
  47.       return
  48.    else
  49.        returnv = false
  50.        for i,v in next, c_model:GetDescendants() do
  51.           if v:IsA("BoxHandleAdornment") then
  52.                returnv = true
  53.                break
  54.                end
  55.            end
  56.        return returnv
  57.    end
  58. end
  59.  
  60. local function remove_esp(c_model)
  61.   for i,v in next, c_model:GetDescendants() do
  62.       if v:IsA("BoxHandleAdornment") then
  63.           v:Destroy()
  64.       end
  65.   end
  66. end
  67.  
  68.  
  69.  
  70.  
  71. local function cast_ray(body_part)
  72.   local rp = RaycastParams.new()
  73.   rp.FilterDescendantsInstances = l_character:GetDescendants()
  74.   rp.FilterType = Enum.RaycastFilterType.Blacklist
  75.  
  76.   local rcr = workspace:Raycast(camera.CFrame.Position, (body_part.Position - camera.CFrame.Position).Unit * 15000,rp)
  77.   if rcr and rcr.Instance:IsDescendantOf(body_part.Parent) then
  78.       return true
  79.   else
  80.       return false
  81.   end
  82. end
  83.  
  84. local function create_esp(c_model)
  85.    if not c_model then
  86.        return
  87.    else
  88.       if check_for_esp(c_model) then
  89.           for i,v in next, c_model:GetChildren() do
  90.              if v:IsA("BasePart") and v:FindFirstChild("BoxHandleAdornment") then
  91.                  local walt = v:FindFirstChild("BoxHandleAdornment")
  92.                   if cast_ray(v) then
  93.                       walt.Color3 = Color3.fromRGB(0,255,0)
  94.                   else
  95.                       walt.Color3 = Color3.fromRGB(255,0,0)
  96.                    end
  97.                end
  98.            end
  99.        else
  100.           for i,v in next, c_model:GetChildren() do
  101.               if v:IsA("BasePart") then
  102.                   local b = Instance.new("BoxHandleAdornment")
  103.                   b.Parent = v
  104.                   b.Adornee = v
  105.                   b.AlwaysOnTop = true
  106.                   b.Size = v.Size
  107.                   b.ZIndex = 2
  108.                   b.Transparency = 0.5
  109.               end
  110.           end
  111.       end
  112.    end
  113. end
  114.  
  115. setfpscap(10000)
  116.  
  117. rs.RenderStepped:Connect(function()
  118.   for i,v in next, e_plrlist do
  119.       if is_pf then
  120.            create_esp(v)
  121.       else
  122.            create_esp(v.Character)
  123.        end
  124.    end
  125. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement