hi, im making a highlight system where you hover an part and a highlight shows, but whenever i move my mouse it keeps playing the tween, how do i fix this?
mouse.Move:Connect(function()
if mouse.Target then
if mouse.Target.Name == "HoverButton" and mouse.Target.Parent.Parent:IsA("Model") and canHighlight == false then
canHighlight = true
if canHighlight == true then
script:WaitForChild("hightlight_hover").Adornee = mouse.Target.Parent.Parent
script:WaitForChild("hightlight_hover").OutlineTransparency = 1
TweenService:Create(script:WaitForChild("hightlight_hover"), tInfo, {OutlineTransparency = 0}):Play()
end
if mouse.Target.Name == "HoverButton" then
if mouse.Target:FindFirstChild("Hover_Attachment") then
local origin = mouse.Target.Position
local finish = mouse.Hit.p
if not mouse.Target:FindFirstChild("attachment1") then
local attachment1 = Instance.new("Attachment")
attachment1.Parent = mouse.Target
attachment1.Name = "attachment1"
local Hover_Beam = script:WaitForChild("Hover_Beam"):Clone()
Hover_Beam.Parent = mouse.Target
Hover_Beam.Attachment0 = mouse.Target.Hover_Attachment
Hover_Beam.Attachment1 = attachment1
mouse.Target.Hover_Attachment.Position = origin
attachment1.Position = finish
end
end
end
else
canHighlight = false
script:WaitForChild("hightlight_hover").Adornee = nil
end
end
end)