Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Despite no errors in output and everything being set up right, script dosent work?

So this is a script inside a part with a clickdetector. it is supposed to make a part is workspace called: "Mask" invisible, but turn it visible If it is visible. but its not working! Help!

if game.Workspace.Mask.Transparency ==1 then
script.Parent.ClickDetector.MouseHoverEnter:Connect(function()
	
game.Workspace.Mask.Transparency = 0


	
end)
	
	else if game.Workspace.Mask.Transparency ==0 then
	
	script.Parent.ClickDetector.MouseHoverEnter:Connect(function()
	
game.Workspace.Mask.Transparency = 1


	
end)
	

1 answer

I fixed up your script and made it look better:

local mask = workspace:WaitForChild("Mask")--You should use "workspace" instead of "game.Workspace", also this line just sets the variable for the mask
script.Parent.ClickDetector.MouseHoverEnter:Connect(function()--Condensing it to 1 connection
	if mask.Transparency == 1 then
		mask.Transparency = 0
	elseif mask.Transparency == 0 then--"else if" is wrong it's supposed to be "elseif"
		mask.Transparency = 1
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.