Advertisement
Arilis

Highlighting Library

Aug 11th, 2022 (edited)
29,987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local load = {}
  2. local HttpService = game:GetService("HttpService")
  3.  
  4. function load:checkClass(instance)
  5.     local Classes = {"Part", "MeshPart", "CornerWedgePart", "WedgePart", "TrussPart", "Model", "SpawnLocation"}
  6.     for i,v in pairs(Classes) do
  7.         if (instance.ClassName == v) then
  8.             return true
  9.         end
  10.     end
  11.     return false
  12. end
  13.  
  14. function load:create(instance, fill, fillTransparency, out)
  15.     if (not instance or not fill or not fillTransparency or not out) then error(string.format("[Highlighter]: An attempt to highlight '%s' was made but an argument was missing. (instance, fill color, fill transparency, outline color")) return end
  16.     if (self:checkClass(instance) and not instance:FindFirstChildOfClass('Highlight')) then
  17.         local Highlighter = Instance.new('Highlight', instance)
  18.         Highlighter.Name = HttpService:GenerateGUID(false)
  19.         Highlighter.Adornee = instance
  20.         Highlighter.DepthMode = "AlwaysOnTop"
  21.         Highlighter.FillColor = fill
  22.         Highlighter.FillTransparency = fillTransparency
  23.         Highlighter.OutlineColor = out
  24.     end
  25. end
  26.  
  27. return load
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement