I haven’t had much experience developing on Studio, but I made this simple script featured inside of a “ClickDetector” object, which is within a “Part.”
The purpose of this script is to make a basic door. If the door is opaque, then when you click it, it should disable collision. If the door is transparent, then when you click it, it should enable collision.
The issue is that the script works for the first time when the door is clicked once (no matter if the door starts with cancollide enabled or disabled). Whenever you try to click it again, nothing happens.
This is my most recent revision of the script. I’ve tried putting it within “while true do” statements and separating the if and elseif statements into two different scripts, to which the former crashed Studio and the latter gave me the same results as my original problem.
Once again, I’m basically a new developer so please put your language into ‘noob’ terms haha.
if script.Parent.Parent.CanCollide == true then
script.Parent.MouseClick:Connect(function()
script.Parent.Parent.Transparency = 1
script.Parent.Parent.CanCollide = false
end)
elseif script.Parent.Parent.CanCollide == false then
script.Parent.MouseClick:Connect(function()
script.Parent.Parent.Transparency = 0
script.Parent.Parent.CanCollide = true
end)
end