Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Making a door open from your voice?

Asked by 10 years ago

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

0
"voice"? you mean chat? Tesouro 407 — 10y

2 answers

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
10 years ago

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)
Ad
Log in to vote
0
Answered by 10 years ago

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
2
You should work on tabbing your scripts, and making them more readable. It might be confusing for beginners. Also, explain your code. Thewsomeguy 448 — 10y

Answer this question