I'm using a click detector, so when a player touches a door, the door will have 1 transparency and wont be cancollide? my script is:
script.Parent.MouseButton1Click:connect(function(click) -- If the door is click do:
script.Parent.Parent.Transparency = 1 -- Sets Transparency to 1 so its invisible
script.Parent.Parent.CanCollide = false -- Sets CanCollide to false so its gothrough
wait(5) -- Door will open for 5 seconds
script.Parent.Parent.CanCollide = true -- Set CanCollide back to true
script.Parent.Parent.Transparency = 0 -- Change the transparency back to 0
if script.Parent.Parent.CanCollide == false then -- If CanCollide is false then
script.Parent.Parent.CanCollide = true -- Set CanCollide to true if its at false
else -- If CanCollide was true already
print("CanCollide part works") -- This is what "game" says if the CanCollide part of the script works.
wait(0.1) -- Wait 0.1 seconds
if script.Parent.Parent.Transparency == 1 then -- If its at 1 then
script.Parent.Parent.Transparency = 0 -- Set it to 0 if its at 1
else -- If the transparency was 0 already
print("Both parts work, Script works") -- This is what "game" says after it checks the Transparency
end -- Ends the first "if"
end -- Ends the seconds "if"
end) -- Ends the whole script
NOTE: If you know, please just dont ignore this, give all what you've got.
Simplier version:
script.Parent.MouseButton1Click:connect(function(click) -- If the door is click do:
script.Parent.Parent.Transparency = 1 -- Sets Transparency to 1 so its invisible
script.Parent.Parent.CanCollide = false -- Sets CanCollide to false so its gothrough
wait(5) -- Door will open for 5 seconds
script.Parent.Parent.CanCollide = true -- Set CanCollide back to true
script.Parent.Parent.Transparency = 0 -- Change the transparency back to 0
end

2 comments
Thanks! Oh well, I learn from my mistakes right?
Yep.