I am trying to make an army game and I am wondering if someone can help me make a parts collision turn off when I click a textbutton.
Get the name of the part you want, Make a "ScreenGui", Insert a "Frame" into it, Go to the frame's properties and make it's background transparency 1, Insert a button into it, Add a script inside the button, Here is the code for that script:
local Debounce = false script.Parent.MouseButton1Click:Connect(function() if Debounce == false then Debounce = true workspace.Part.CanCollide = false -- Replace "workspace.Part" with whatever name you have for your door. workspace.Part.Transparency = 0.3 -- Same here. print("Door opened") elseif Debounce == true then Debounce = false workspace.Part.CanCollide = true -- Same here too lol. workspace.Part.Transparency = 0 -- You know the drill lol. print("Door closed") end end)
Comment down on this answer if you want the button to be a click detector instead.