hmm. I don’t know why it does that. But I really recommend to have a localscript in startergui or playerscripts that every rendersteps it detects if a mouse is hovering over a part with the “Highlightable” tag or something. Then, at the start of the script create a highlight and parent it to the script, and when the mouse is hovering over it make the highlight addonore the part.
You should be handling these effects on the client side, and you shouldn’t be needing to put a script into every single model.
I would recommend using CollectionService, tagging the parts you want to be highlighted, and in StarterPlayerScripts, modify it as needed in a LocalScript.
Code (make sure to tag all parts you want to be highlighted when hovered with “Highlightable”):
--//Services
local CollectionService = game:GetService("CollectionService")
--//Functions
local function InitializeHighlightable(part)
local prompt = part.ClickDetector
local highlight = part.highlight
prompt.MouseHoverEnter:Connect(function()
highlight.OutlineTransparency = 0
end)
prompt.MouseHoverLeave:Connect(function()
highlight.OutlineTransparency = 1
end)
end
CollectionService:GetInstanceAddedSignal("Highlightable"):Connect(InitializeHighlightable)
for i, highlightable in CollectionService:GetTagged("Highlightable") do
task.spawn(InitializeHighlightable, highlightable)
end
Hello, I do not see any major problem with this glitch, I have no idea why It happens but there are a few things that might be causing the issue:
Multiple Scripts If you have multiple copies of this script in different models, and they all reference the same Highlight object, they could interfere with each other. Ensure that each model has its own unique Highlight object.
Event Overlap : If the mouse quickly moves between objects, the MouseHoverLeave event of one object might not trigger before the MouseHoverEnter event of another object. This can cause multiple objects to appear highlighted.
Also, consider using tweens that may be helpful:
local TweenService = game:GetService("TweenService")
local prompt = script.Parent.ClickDetector
local highlight = script.Parent.Highlight
local fadeIn = TweenService:Create(highlight, TweenInfo.new(0.5), {OutlineTransparency = 0})
local fadeOut = TweenService:Create(highlight, TweenInfo.new(0.5), {OutlineTransparency = 1})
prompt.MouseHoverEnter:Connect(function()
fadeOut:Cancel() -- Cancel any ongoing fade-out
fadeIn:Play()
end)
prompt.MouseHoverLeave:Connect(function()
fadeIn:Cancel() -- Cancel any ongoing fade-in
fadeOut:Play()
end)
This script uses the TweenService to smoothly transition the OutlineTransparency property of the Highlight object. The Cancel method ensures that if a fade-in or fade-out is already in progress, it will stop, ensuring smoother transitions. I hope any of this information helps!
I already did help him earlier, you can scroll up easily.
Yeah, it doesn’t. What does matter though is you giving them scripts that do not solve the problem. It would’ve been fine if the scripts you provided actually solved his problem, but all you did was make it more complicated by adding TweenService. It just wastes the OP’s time when they have to try a script that was written without even intending to fix the problem.
Not sure if you meant to be rude with this, but the whole purpose of a forum is to discuss.
Hello, thank you very much for the code, I tried it, but it s not working, most likely because i did something wrong, i tagged the model as highlightable but the highlight isn t showing.
Wow, i m so dumb. Anyway, this solved the problem, sorry for causing inconveniences. Thank you SO much for helping me!
Edit: I accidentally put the wrong response as solution, but I put it on your initial message now