Why does this happen?

Here’s the issue:

Why did it unbind thrice, while the line above it only printed once? I would have expected it to only unbind once as well. I also did ctrl shift f, and this is the only unbind with this name.

Here’s the code:

Code for copy paste
function module.RemoveHighlight(part)
	
	print(part, CommonlyUsedVariablesModule.numberSelected)
	
	if boxes[part] == nil then
		return
	end
	
	CommonlyUsedVariablesModule.numberSelected -= 1
	
	if inputCylinderReturnArrayOfTwoJoints[part] ~= nil then -- cylinder	
		revertThe1of2from3("Color", part, partColorTable)
	elseif displayPartReturnsArrayOfTwoBlocks[part] ~= nil then -- displayPart
		revertThe1of2from3("Parent", part, partParentTable, displayPartsHighlight)
	else -- everything else
		revertThe1of2from3("Parent", part, partParentTable, partsHighlight)
	end
	
	if attachmentArrowsTable[part] ~= nil then			
		attachmentArrowsTable[part]:Destroy()
		attachmentArrowsTable[part] = nil
	end
	
	if CommonlyUsedVariablesModule.numberSelected < 1 then
		print(CommonlyUsedVariablesModule.numberSelected < 1)
		RunService:UnbindFromRenderStep("highlightsRainbow")
	end

end

Thanks!

Pretty sure the reason it unbinds 3 times but only prints once is because you might have several functions with “highlightsRainbow” ?

Could you show me any references to “highlightsRainbow”?

What is cycleThroughcolors, lets look at that function.

Code for copy paste
local t = 8 -- how long it takes to go through the rainbow
local fromHSV = Color3.fromHSV

local function cycleThroughColors()
	local hue = (tick()%t) / t
	local color = fromHSV(hue, 0.8, 1)
	partsHighlight.OutlineColor = color
	displayPartsHighlight.FillColor = color
end

Honestly I am not sure, what I can tell you is try to add a debounce to the line 154 function as to prevent it firing more than once, as well maybe changing < to < = (no space)

The warning is telling you that it found three functions bound with the key highlightsRainbow and that it is unbinding all three. If you want to have three different instances being highlighted and be able to unbind them separately, you will need to give a unique key to BindToRenderService for each instance.

1 Like

You have called :BindToRenderStep with the name “highlightsRainbow” 3 different times before calling :UnbindFromRenderStep.

@MayorGnarwhal and @Judgy_Oreo are both correct, who do I mark as the solution :sweat:

We should fight to the death @MayorGnarwhal what do you think

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