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.
✓ ANSWER ACCEPTED
How to open and close a door using a textButton?
1 answer
✓ Accepted answer
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.
2 comments
0
Thank you so much!
0
No problem!
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
client sided or server sided?
tbh I don't know because I don't know a lot about scripting.
client sided is just on the client and server sided is for everyone
oh so server sided means it will basically happen for everyone and not just one person? If so then server sided.