Easy Written By FreakingHulk

Chat controlled door Created on: 01-01-2019

How to make a chat controlled door.

Intro

Hey! Thanks for checking out my tutorial. I'm FreakingHulk, and I'm going to show you how to make a chat controlled door.

Creating a Door

Insert a new Part into the workspace, and scale it how you like. The name doesn't matter.

Scripting the Door

Now it's time to code our door. Right click on your door, and insert a Script.

Delete the "print("hello, world!")", then paste this code in.

local door = script.Parent


-- Make sure the door is anchored.

door.Anchored = true

function open()

door.Transparency = 1

door.CanCollide = false

end

function close()
	door.Transparency = 0

door.CanCollide = true

end

Okay! So what this is doing is making functions that the game calls when a player says a certain word(s) in the chat. When a player says "open door", the door will open. When they say "close door", the door will close.

-- This block will make a chat message open/close the door.

game.Players.PlayerAdded:Connect(function(p)

p.Chatted:Connect(function(msg)

	local message = msg:lower()


	if message == "open door" then

		open()

	end


if message == "close door" then

	close()

end

end)

end) Make sure these code blocks are in the same script, or it will error and crash. Other than that, it should work! I've used this method in multiple games, and it has never failed me!

Thanks for reading! And always remember... CODE ON!

Easy Written By FreakingHulk

See FreakingHulk's profile on Roblox

Discussion