How and why does this not work, I got multiple people telling the same script to do what I'm doing and it doesn't work...
01 | local Button = script.Parent |
02 | local Door 4 = game:GetService( "Workspace" ):WaitForChild( "Door4" ) |
03 | Door 4. Anchored = true |
04 |
05 | Button.MouseButton 1 Click:Connect( function () |
06 | if Door 4. CanCollide then |
07 | Door 4. CanCollide = not Door 4. CanCollide |
08 | elseif not Door 4. CanCollide then |
09 | Door 4. CanCollide = true |
10 | end |
11 | end ) |
Try this, I am unsure of what your game looks like so, here.. and by the way, for your if statement it doesn't return a value... which causes an error...
01 | local button = script.Parent |
02 | local door = workspace.Door 4 |
03 | door.Anchored = true |
04 | local debounce = true |
05 | button.MouseButton 1 Click:Connect( function () |
06 | if debounce = = true then |
07 | door.CanCollide = false |
08 | debounce = false |
09 | else |
10 | door.CanCollide = true |
11 | debounce = true |
12 | end |
13 | end ) |
Simple if statement fix, remember to answer the question if this script works, thanks