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

How would I make the following script open a door when a player says a certain word?

Asked by 10 years ago
1door = script.parent
2msg = string.lower(msg)
3 if (msg == "open") then
4    door.Transparency = 1
5    door.CanCollide = false
6    wait(4)
7    door.Transparency = 0
8    door.CanCollide = true
9end

I'm trying to make this script open a door, then close it, but so far- No luck. Any input would be helpful, thank you!

1 answer

Log in to vote
1
Answered by 10 years ago
01door = script.Parent
02 
03game.Players.PlayerAdded:connect(function(player)
04    player.Chatted:connect(function(msg)
05        if msg == "open door" then
06        door.Transparency = 1
07        door.CanCollide = false
08            elseif msg == "close door" then
09            door.Transparency = 0
10            door.CanCollide = true
11        end
12    end)
13end)
0
Thanks loads! nightmare13542 45 — 10y
Ad

Answer this question