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

How can I restore clickdetector in other part?

Hi, I made script for light switch but which removing clickdetector from part but how can I restore this clickdetector in other part?

This is this script

script.Parent.ClickDetector.MouseClick:Connect (function(plr)
	script.Parent.Parent.ON.Transparency=1
	script.Parent.Parent.OFF.Transparency=0
	script.Parent.ClickDetector:remove()
end)

5 comments

0

maybe add a wait function then restore it?

0

But how can I restore it?

0

maybe use vector3.new() too tp a invisible block with click detector(hitbox) and when u click it tp away so u cant click it but it tp the other invisible block to the other switch, i explain if confuse

0

I tried it but I'm looking for something better

0

u can turn the clicking range to 0

1 answer

✓ Accepted answer
function mouseclick ()
script.Parent.Parent.ON.Transparency=1
script.Parent.Parent.OFF.Transparency=0
--turning it off
script.Parent.ClickDetector.maxactivationdistance = 0
wait(3)
--turning it on
script.Parent.ClickDetector.maxactivationdistance = 32
end)

script.Parent.ClickDetector.MouseClick:Connect(mouseclick)

1 comment

0

Thank you very much, I was looking for that

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