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

Making a door open from your voice?

How can I make a door open from my voice (And no one else's) to where I say a certain word it opens.

1 comment

0

"voice"? you mean chat?

2 answers

This bit of code receives all the messages people send in the chat and checks to see if you say the opening command (Which in this particular script is open):

game.Players.PlayerAdded:connect(function(player)
	player.Chatted:connect(function(message)
		if message == "open" and player.Name == "Skitle1802" then
		-- Door opening script here
		end
	end)
end)

LocalScript required below -- E D I T E D --

plr=game:service("Players").LocalPlayer --The Player
if plr.Name:lower()==("PLAYER"):lower()then --Non-Cap Sensitive, for example, if the script were print(plr.Name:lower()--[[For my name]]), it'd turn out like this; theedeathcaster, also change the PLAYER name to your name for the script to work
plr.Chatted:connect(function(msg) --If plr's name matches, then you are granted access
if msg:lower()=="open"then --Chat commands
--Rest of script here
end --The end for the if loop
end) --The end for the connect(function() loop
elseif not plr.Name:lower()==("PLAYER"):lower()then --If plr's name doesn't match to PLAYER's then..
print("Sorry, "..plr.Name:lower()..", But you are not granted access to voice commands") --They aren't allowed to
end --The end for the if loop

1 comment

2

You should work on tabbing your scripts, and making them more readable. It might be confusing for beginners. Also, explain your code.

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