So this has been stuck in my head all day and I know it is obviously possible, but I don't know how to do it. Let's say I have a Click Detector on a "Part". Now, if I click this part, I want it to change the Can Collide to false and the Transparency to 0.5. Simple code. But, now, if I click it again, I want those properties to go back to Can Collide being true and the Transparency being false. So, how would I achieve that? Thanks for your help!
COMMUNITY QUESTION
How to make ClickDetector have Multiple Functions?
1 answer
Well this is simply achievable with a boolean flag and an if statement.
local Open = false
clickdetector.MouseClick:connect(function()
if Open == false then
Open = true
part.Transparency = 0.5
part.CanCollide = false
else
Open = false
part.Transparency = 0
part.CanCollide = true
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
