Okay, so I am making a game, but I have a door that when it is touched with a key a decal will change from a cross to a tick, make the CanCollide on the door turn to false, then switches the decal back to a cross then changing to CanCollide on the door turn to true. It works, but the CanCollide on the door does not change, the transparency on the door is set to 1.
Here is the layout.
Key: http://prntscr.com/9j188p
Door (It is in workspace) : http://prntscr.com/9j18ft
Here is the code (This script is located in the key, as you saw on the screenshot) :
enable = true
function touch(hit)
if enable == true then
enable = false
if hit:findFirstChild("Door") ~= nil then
if hit.Door.Value == "KeyCard" and script.Parent.Key.Value == "KeyCard" then
game.Workspace.Gate1.Picture.Decal.Texture = "http://www.roblox.com/asset/?id=336445408"
game.Workspace.door.CanCollide = false
wait(2)
game.Workspace.Gate1.Picture.Decal.Texture = "http://www.roblox.com/asset/?id=336442458"
game.Workspace.door.CanCollide = true
end
end
end
enable = true
end
script.Parent.Handle.Touched:connect(touch)

3 comments
How many instances with the name "door" are in the workspace? Could you maybe put a link to a screenshot of the entire workspace?
http://prntscr.com/9j1qab
Wait, why put a script in a key? What if you want more than one key? You will have multiple scripts when you only need one.