What did I do wrong? I'm trying to make a textbox that on click it opens that make a part be able to go through and if you click it again it the part isn't able to go through? (CODE IN ANSWERS)
Hey, I fixed up the script for you. Also, most importantly use a "Text Button" instead of a Text Box.
local button = script.Parent local door = game.Workspace.Door door.Anchored = true button.MouseButton1Click:Connect(function() if door.CanCollide == true then door.CanCollide = false elseif door.CanCollide == false then door.CanCollide = true end end)
local Button = script.Parent Door = game.workspace.Door function onClick() if Door.CanCollide == false then Door.CanCollide == true else Door.CanCollide == true then Door.CanCollide == false end end Button.MouseButton1Click:connect(OnClick)
local Button = script.Parent local Door = game:GetService("Workspace"):WaitForChild("Door") Door.Anchored = true Button.MouseButton1Click:Connect(function() if Door.CanCollide then Door.CanCollide = not Door.CanCollide elseif not Door.CanCollide then Door.CanCollide = true end end)