Make part collidable when another part is touched

Hi guys, i have a question about a little script that i dont understand how to do it.
So, i want to make like if the button is touched, then the other part (for example door) cancolide.
Here what i did, but it doesnt work

local function Coolsauce()

game.Workspace.door.CanCollide = true

end

game.Workspace.door2.Touched:Connect(Coolsauce)

Any output errors we can see? The script looks fine. Also you should make sure that door IS NOT can collide.

1 Like

There is no errors, i tried everything

Did you set CanCollide to true for door? You should initially make it false first.

yea i did, but still nothing has changed

Can you make a video of it? The script looks really nothing wrong.

WAITTT IT WORKED, Tysm dude!!! .DDDD

1 Like

Now you can mark my comment as solution.

2 Likes

No no I mean, mark the 4th comment as the solution.

You just said coolsauce instead of function() so you can try it.

local function Coolsauce()

game.Workspace.door.CanCollide = true

end

game.Workspace.door2.Touched:Connect(function(Coolsauce))


```

No need to add function(), just:

Connect:(Coolsauce)

actually its :Connect(Coolsauce)
also why is the function called Coolsauce…?

Whoops! Looks like my spelling is acting up. Thanks for telling lol.

lol i didnt knew what to type there, instead my brain said Coolsauce lmao