Hiya, I was wondering if anyone could help me out with this. I've typed this script, however, when I go into testing mode nothing happens.

Any help would be greatly appreciated.

function OnClick()
	if script.Parent.Parent.Parent.LEDDisplay.End.uni0045.Transparency == 0.98 then
	script.Parent.Parent.Parent.LEDDisplay.End.uni0045.Transparency = 0
	script.Parent.Parent.Parent.LEDDisplay.End.uni0064.Transparency = 0
	script.Parent.Parent.Parent.LEDDisplay.End.uni006E.Transparency = 0
elseif script.Parent.Parent.Parent.LEDDisplay.End.uni0045.Transparency == 0 then
	script.Parent.Parent.Parent.LEDDisplay.End.uni0045.Transparency = 0.98
	script.Parent.Parent.Parent.LEDDisplay.End.uni0064.Transparency = 0.98
	script.Parent.Parent.Parent.LEDDisplay.End.uni006E.Transparency = 0.98
	end
end
script.Parent.ClickDetector.MouseClick:Connect(OnClick)

Thanks

2 comments

0

It's because of floating precision (https://www.youtube.com/watch?v=PZRI1IfStY0). Even though you're telling your script to check Transparency to 0.98, the Transparency property may actually be 0.98000001907349 thus invalidating your selection. A way to mitigate this may be to simply multiply your value by 100, take a floor of the new value and do a comparison of an integer to an integer.

0

Ah, I got it now, thanks for the help.