Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to detect a "CanCollide false" part with a Touched event?

Asked by 5 years ago
Edited 5 years ago

I'm making a simple door. When you touch a part in front of the door, it opens. I have two "different" doors. When you touch the part, the first position disappears and the seconds appears instead får two seconds. Allowing you enough time to walk through. Something is bothering me though, the invisible part you have to touch has to have "CanCollide" on for it to be working. This makes the player bump a tiny bit when walking through the door, I wish the door would be much cleaner. Is there any way you can detect a "CanCollide false" part with a Touched event, or can you use another way to make this possible? Thank you very much.

game.Workspace.TouchPart.Touched:Connect(function()

    game.Workspace.TouchPart.CanCollide = false
    game.Workspace.FirstDoor.DoorPos1.Transparency = 1
    game.Workspace.FirstDoor.DoorPos1.CanCollide = false
    game.Workspace.FirstDoor.DoorPos2.Transparency = 0
    game.Workspace.FirstDoor.DoorPos2.CanCollide = true

    wait(3)

    game.Workspace.TouchPart.CanCollide = true
    game.Workspace.FirstDoor.DoorPos1.Transparency = 0
    game.Workspace.FirstDoor.DoorPos1.CanCollide = true
    game.Workspace.FirstDoor.DoorPos2.Transparency = 1
    game.Workspace.FirstDoor.DoorPos2.CanCollide = false

end)

Edit:

Nevermind, seems like something went wrong earlier when I tested the script. It works perfectly fine even when the part has CanCollide set at false. My bad!

0
Yeah, Touched still fires even if the part has collisions disabled. User#24403 69 — 5y
0
Yes Optikk 499 — 5y
2
Yes, you could even try region3. Alvin_Blox 52 — 5y
0
Better solution ^ User#24403 69 — 5y
0
no zaniac10 15 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Answered.

Ad

Answer this question