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

Script using CanCollide wont make door CanCollide true please help?

Asked by 8 years ago
1function onClicked(playerWhoClicked)
2     game.Workspace.Model_CH.Building_Door_House.CanCollide=true
3end
4 
5script.Parent.ClickDetector.MouseClick:connect(onClicked)

There is a ClickDetector in the brick and it doesn't work the door stays CanCollide False Thanks!

0
Is there an error? Models don't have the can collide property. If you're using a part or a union, your probably not getting the object correctly. User#11440 120 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

If the script is a local script that make it a regular script and then also try the script without the "playerWhoClicked". It would look like this.

1function onClicked()
2    game.Workspace.Model_CH.Building_Door_House.CanCollide = true
3end
4 
5script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
Function Parameters are optional. I also doubt he used a Local Script, but if he did this would be correct. User#11440 120 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

Make sure to put this in a regular script.

1local CD = script.Parent:WaitForChild("ClickDetector") -- CD = Click Detector
2 
3function onClicked(player)
4    game.Workspace.Model_CH.Building_Door_House.CanCollide = true
5end
6 
7CD.MouseClick:connect(onClicked)
0
This is the same script that he showed! Kyokamii 133 — 8y

Answer this question