Highlight Issues on Roblox [FIXED]

Okay so, for some fun I decided to make a script where if you hover over any one of these pumpkins the one you hover over will be highlighted:


like this:
image
here’s the composition of each pumpkins contents:
image
The problem with this is that after duplicating a pumpkin it seems as if the script of the first pumpkin applies onto the duplicated one ( aka if the first one is hovered over BOTH pumpkins are highlighted ). I have absolutely no idea how this could be since scripts don’t communicate with each other unless you make them.
Here’s the script (this is the same for all pumpkins):

--Variables
local Pumpkin = script.Parent
local ClickDetector = Pumpkin.ClickDetector
local Highlight = Pumpkin.Highlight

function HighlightOn()
	Highlight.Enabled = true
end

function HighlightOff()
	Highlight.Enabled = false
end

ClickDetector.MouseHoverEnter:Connect(HighlightOn)
ClickDetector.MouseHoverLeave:Connect(HighlightOff)

can you share the script so that it would be easy to understand what you have done

1 Like

Yes I forgot to put that in I did now though.

try placing pumpkins far apart because I don’t think there is any error in the script

or you might have messed up with parent child thing between script and pumpkin

It’s nothing on your end, Highlights themselves are just extremely buggy. You seem to have found another one of the few bugs Highlight has.

1 Like

Ah I see, I have never really had a good experience with highlights.

The thing about this is, in other games they use the exact same system as I do however their highlights don’t glitch as mine do and I think I know as to why this is.

EDIT:
I found the problem. So for some reason while running in studio this glitches, but when you actually play the place in Roblox this glitch is fixed.

Should Work on the items separately,
Put In ServerScriptService:

function HighlightOn(Object)
	Object.Enabled = true
end
function HighlightOff(Object)
	Object.Enabled = false
end




for _,HL in pairs(workspace.HL:GetChildren()) do -- Random Name of my Folder
	if HL:IsA("Part") then
		HL.ClickDetector.MouseHoverEnter:Connect(function()
			HighlightOn(HL:FindFirstChildOfClass("Highlight"))
		end)
		HL.ClickDetector.MouseHoverLeave:Connect(function()
			HighlightOff(HL:FindFirstChildOfClass("Highlight"))
		end)
		end
end

Edit:
Right after i tested this, it broke, sad.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.