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

Restricted door gone wrong?

I am currently working on making a restricted door where when a certain person says open the door will open. i wrote some script and it hasnt worked but i dont know why can anyone help?

game.Players.PlayerAdded:connect(function(player)
    if player.Name == "Player" then
        player.Chatted:connect(function(msg)
 			if msg == "open" then
				Run()
			end
        end)
    end
end)

1 answer

✓ Accepted answer

Assuming Run an existing function, it should be working..

Run = function()
  print'ran'
end
game.Players.PlayerAdded:connect(function(player)
    if player.Name == "Player" then
        player.Chatted:connect(function(msg)
            if msg == "open" then
                Run()
            end
        end)
    end
end)

The sample above, for instance, would print "ran" if "Player" chats "open"

1 comment

1

I actually put in some else statements to compliment the ifs and it worked so thanks for the help anyway

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