Advertisement
SlyHades66

SCAPESP v1

Apr 4th, 2018
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.31 KB | None | 0 0
  1. --[[
  2.   /$$$$$$                                /$$$$$$$$  /$$$$$$  /$$$$$$$                     /$$  
  3.  /$$__  $$                              | $$_____/ /$$__  $$| $$__  $$                  /$$$$  
  4. | $$  \__/  /$$$$$$$  /$$$$$$   /$$$$$$ | $$      | $$  \__/| $$  \ $$       /$$    /$$|_  $$  
  5. |  $$$$$$  /$$_____/ |____  $$ /$$__  $$| $$$$$   |  $$$$$$ | $$$$$$$/      |  $$  /$$/  | $$  
  6.  \____  $$| $$        /$$$$$$$| $$  \ $$| $$__/    \____  $$| $$____/        \  $$/$$/   | $$  
  7.  /$$  \ $$| $$       /$$__  $$| $$  | $$| $$       /$$  \ $$| $$              \  $$$/    | $$  
  8. |  $$$$$$/|  $$$$$$$|  $$$$$$$| $$$$$$$/| $$$$$$$$|  $$$$$$/| $$               \  $/    /$$$$$$
  9.  \______/  \_______/ \_______/| $$____/ |________/ \______/ |__/                \_/    |______/
  10.                               | $$                                                            
  11.                               | $$                                                            
  12.                               |__/                                                                                    
  13. ]]--
  14.  
  15.  
  16. --Update Speed--
  17. _G.speed = 2 --Raise this if you're lagging(execute _G.speed = [desired speed])
  18. --Update Speed--
  19.  
  20. --Do Not Edit Anything!!!--
  21.  
  22. --Variables--
  23. local plrs = game:GetService("Players")
  24. local wrk = game:GetService("Workspace")
  25. local lp = plrs.LocalPlayer
  26. local camera = wrk.CurrentCamera
  27. local debounce = 0
  28. --Variables--
  29.  
  30. --Instances--
  31. local chams = Instance.new("Folder")
  32. chams.Name = "Chams"
  33. chams.Parent = game:GetService("CoreGui")
  34. --Instances--
  35.  
  36. --Functions--
  37. function checkWalls(limb, plr)
  38.     if plrs:FindFirstChild(plr.Name) then
  39.    
  40.         if plr.Character and plr.Character.HumanoidRootPart and lp.Character and lp.Character.HumanoidRootPart then
  41.             local hit = workspace:FindPartOnRayWithIgnoreList(Ray.new(lp.Character.HumanoidRootPart.CFrame.p, (limb.CFrame.p-lp.Character.HumanoidRootPart.CFrame.p).unit*500), {camera, lp.Character, chams}, false, true)
  42.  
  43.             if hit:IsDescendantOf(plr.Character) then
  44.                 return true
  45.             end
  46.            
  47.             return false
  48.         end
  49.        
  50.     end
  51. end
  52.  
  53. function setColor(v, limb)
  54.     if v.TeamColor == lp.TeamColor and checkWalls(limb, v) then --Friendly and Visible(Green)
  55.         return Color3.fromRGB(0, 255, 0)
  56.     elseif v.TeamColor == lp.TeamColor and not checkWalls(limb, v) then --Friendly and Not Visible(Yellow)
  57.         return Color3.fromRGB(255, 255, 0)
  58.     elseif v.TeamColor ~= lp.TeamColor and checkWalls(limb, v) then --Enemy and Visible(Red)
  59.         return Color3.fromRGB(255, 0, 0)
  60.     elseif v.TeamColor ~= lp.TeamColor and not checkWalls(limb,v) then --Enemy and Not Visible(Orange)
  61.         return Color3.fromRGB(255, 170, 0)
  62.     end
  63. end
  64.  
  65. function createCham(limb, plr, fold)
  66.     local cham = Instance.new("BoxHandleAdornment")
  67.     cham.Name = "Cham"
  68.     cham.Color3 = setColor(plr, limb)
  69.     cham.Adornee = limb
  70.     cham.Size = limb.Size+Vector3.new(0.01, 0.01, 0.01)
  71.     cham.AlwaysOnTop = true
  72.     cham.ZIndex = 1
  73.     cham.Parent = fold
  74. end
  75.  
  76. function newCham(v)
  77.     if chams:FindFirstChild(v.Name) then
  78.         chams[v.Name]:Destroy()
  79.     end
  80.  
  81.     local char = Instance.new("Folder")
  82.     char.Name = v.Name
  83.     char.Parent = chams
  84.  
  85.     if v.Character then
  86.    
  87.         for _,c in pairs(v.Character:GetChildren()) do
  88.             if c:IsA("BasePart") then
  89.                 createCham(c, v, char)
  90.             end
  91.         end
  92.        
  93.     end
  94. end
  95. --Functions--
  96.  
  97. --Framework--
  98. plrs.PlayerRemoving:connect(function(plr)
  99.     if chams:FindFirstChild(plr.Name) then
  100.         chams[plr.Name]:Destroy()
  101.     end
  102. end)
  103.  
  104. plrs.PlayerAdded:connect(function(v)
  105.     spawn(function()
  106.         repeat wait() until v.Character
  107.  
  108.         if v.Character then
  109.             newCham(v)
  110.         end
  111.        
  112.         v.CharacterAdded:connect(function(char)
  113.             repeat wait() until char.HumanoidRootPart
  114.             newCham(v)
  115.         end)
  116.     end)
  117. end)
  118.  
  119.  
  120. for _,v in pairs(plrs:GetChildren()) do
  121.     if v ~= lp then
  122.         spawn(function()
  123.         repeat wait() until v.Character
  124.        
  125.             if v.Character then
  126.                 newCham(v)
  127.             end
  128.            
  129.             v.CharacterAdded:connect(function(char)
  130.                 repeat wait() until char.HumanoidRootPart
  131.                 newCham(v)
  132.             end)
  133.         end)
  134.        
  135.     end
  136. end
  137.  
  138. game:GetService("RunService").RenderStepped:connect(function()
  139.     if debounce%_G.speed == 0 then
  140.    
  141.         for _,v in pairs(chams:GetChildren()) do
  142.             for _,c in pairs(v:GetChildren()) do
  143.                 c.Color3 = setColor(plrs[v.Name], c.Adornee)
  144.             end
  145.         end
  146.        
  147.     end
  148.    
  149.     debounce = debounce+1
  150. end)
  151. --Framework--
  152.  
  153. --Do Not Edit Anything!!!--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement