Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script using CanCollide wont make door CanCollide true please help?

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!

1 comment

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.

2 answers

✓ Accepted answer

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)

1 comment

0

Function Parameters are optional. I also doubt he used a Local Script, but if he did this would be correct.

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)

1 comment

0

This is the same script that he showed!

This discussion is preserved as it was. New answers, comments, and votes are closed.