Advertisement
Nova355killer

Team Color Chams

Apr 18th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. boxHandle = function(part, color)
  2. if part.ClassName == "Part" or part.ClassName == "MeshPart" then
  3. local cham = Instance.new("BoxHandleAdornment")
  4. cham.Parent = part
  5. cham.Adornee = part
  6. cham.ZIndex = 2
  7. cham.AlwaysOnTop = true
  8. cham.Size = part.Size
  9.  
  10. if #game:GetService("Teams"):GetTeams() > 0 then
  11. cham.Color3 = color
  12. else
  13. cham.Color3 = Color3.new(255, 0, 0)
  14. end
  15. end
  16. end
  17.  
  18. createChams = function(player)
  19. pcall(function()
  20. if player.Character and player.Character.HumanoidRootPart and not (player.Name == game:GetService("Players").LocalPlayer.Name) then
  21.  
  22. for _,v in pairs(player.Character:GetChildren()) do
  23. if v.ClassName == "Part" or v.ClassName == "MeshPart" then
  24. if player.Character:WaitForChild(v.Name):FindFirstChild("BoxHandleAdornment") then
  25. player.Character:WaitForChild(v.Name):FindFirstChild("BoxHandleAdornment"):Destroy()
  26. end
  27.  
  28. boxHandle(v, player.TeamColor.Color)
  29. end
  30. end
  31.  
  32. boxHandle(player, player.TeamColor.Color)
  33.  
  34. print("created " .. player.Name)
  35. end
  36. end)
  37. end
  38.  
  39. while wait(1) do
  40. for _,v in pairs(game:GetService("Players"):GetPlayers()) do
  41. createChams(v)
  42. end
  43. end
  44.  
  45. game:GetService("Players").PlayerAdded:connect(function(player)
  46. wait()
  47. createChams(player)
  48. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement