Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can I script a tool that opens and closes doors?

I am trying to make a garage door opener that when clicked will toggle a door's cancollide to false/true. (This would be a tool, so an entire team can use it anywhere on the map).

1 answer

✓ Accepted answer

The following code comes from:

https://developer.roblox.com/en-us/api-reference/event/Mouse/Button1Down

Where it states:

print("Button1Down")

Change it to fit your code. Eg. Create a check to see if the door is true or false and act accordingly

local Tool = script.Parent --make sure this is a Tool object
 
Tool.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
		print("Button1Down")
	end)
end)

Next time, please show an example of what you have attempted/tried so that we can help to place you on the correct path to fixing your mistakes.

Cheers!

This discussion is preserved as it was. New answers, comments, and votes are closed.