Need help scripting a door-locking system

Hello everyone! I need help
So what I am trying to achieve is
When a player types a command in chat "!lock door 1 " it locks only the first door, and if the player typed “!lock door 2” it does the same thing but for the second door. Is it somehow possible to do?

Hello. Yes, it’s possible! You can use this tutorial: Roblox | How to make a Chat Door [FE] - YouTube

Yes, but I Have separate doors and want them to be opened with one command and adding a number of the door. Here’s an example, i type “lock door (number of the door here)” and it locks only this door. Sorry for poor english.

You can do

local door1 = game.Workspace.door1
local door2 = game.Workspace.door2

game.Players.PlayerAdded:Connect(function(p)
	p.Chatted:Connect(function(c)
		if c == "!lock door 1" then
			door1.CanCollide = true
		elseif c == "!lock door 2" then
			door2.CanCollide = true
		end
	end)
end)
1 Like