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...
local Button = script.Parent local Door4 = game:GetService("Workspace"):WaitForChild("Door4") Door4.Anchored = true Button.MouseButton1Click:Connect(function() if Door4.CanCollide then Door4.CanCollide = not Door4.CanCollide elseif not Door4.CanCollide then Door4.CanCollide = true end 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...
local button = script.Parent local door = workspace.Door4 door.Anchored = true local debounce = true button.MouseButton1Click:Connect(function() if debounce == true then door.CanCollide = false debounce = false else door.CanCollide = true debounce = true end end)
Simple if statement fix, remember to answer the question if this script works, thanks