function module:CheckStructure()
local mouse = Player:GetMouse()
local target = mouse.Target
if not target then
self:RemoveHighlight()
return
end
if target ~= self.Plot.Objects then
if target:FindFirstAncestor(self.Plot.Objects.Name) then
target = target:FindFirstAncestorWhichIsA("Model")
if target.Parent == self.Plot.Objects then
self:AddHighlight(target)
else
self:RemoveHighlight()
end
else
self:RemoveHighlight()
end
else
self:RemoveHighlight()
end
end
function module:RemoveHighlight()
if not Outlined then return end
local Highlight = Outlined:FindFirstChildOfClass("SelectionBox")
if Highlight then
Highlight:Destroy()
end
Outlined = nil
end
function module:AddHighlight(target:Model)
if Outlined == target then return end
Outlined = target
local deleteOutline = deleteBox:Clone()
deleteOutline.Parent = target
deleteOutline.Adornee = target
end
THIS WORKS FINE, the only problem is that it is not spam proof at all, if i change target too quickly the selectionbox will remain on the target model, how can i fix this issue?