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 7 years ago
function onClicked(playerWhoClicked)
     game.Workspace.Model_CH.Building_Door_House.CanCollide=true
end

script.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 — 7y

2 answers

Log in to vote
0
Answered by 7 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.

function onClicked()
    game.Workspace.Model_CH.Building_Door_House.CanCollide = true
end

script.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 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Make sure to put this in a regular script.

local CD = script.Parent:WaitForChild("ClickDetector") -- CD = Click Detector

function onClicked(player)
    game.Workspace.Model_CH.Building_Door_House.CanCollide = true
end 

CD.MouseClick:connect(onClicked)
0
This is the same script that he showed! Kyokamii 133 — 7y

Answer this question