so I want to make a script where if you hover the mouse on a part it will get a outline but when you take it off it will disappear, but if you spam the function by entering and leaving the mouse on the part, the part either remains with the outline or without, or even flickering when entering mouse, so I added a db, but that didn t really work.
If you think you could help I would appreciate it.
Here is the script:
local part = script.Parent
local db = false
part.ClickDetector.MouseHoverEnter:Connect(function()
if db == true then
return
else
db = true
repeat
part.Highlight.OutlineTransparency = part.Highlight.OutlineTransparency - 0.5
wait(0.05)
until part.Highlight.OutlineTransparency <= 0
wait(0.1)
db = false
end
end)
part.ClickDetector.MouseHoverLeave:Connect(function()
if db == true then
return
else
db = true
repeat
part.Highlight.OutlineTransparency = part.Highlight.OutlineTransparency + 0.5
wait(0.05)
until part.Highlight.OutlineTransparency >= 1
wait(0.1)
db = false
end
end)