Answered by
6 years ago Edited 6 years ago
It is possible to use a local script to listen to the mouse click event, as long as the local script is in a place they can run in, generally PlayerScripts. The only thing you'll need to change is script.Parent
to the path of your click detector.
1 | local clickDetector = ... |
3 | local function BuildBrick(client) |
4 | if client = = game:GetService( "Players" ).LocalPlayer then |
5 | clickDetector.Parent.CanCollide, clickDetector.Parent.Transparency = true , 0 |
9 | clickDetector.MouseClick:Connect(BuildBrick) |
Notice the additional check. That is because MouseClick
can fire even if it was not the local player! The code in the if
will not execute if the local player does not click the part
.