player.Chatted() function not working?
So I was making a verification-kinda thing in my obby game that when you guessed the correct code (random each server) in the chat you will teleport to the next level, and when you guessed it wrong you will die, and start over. But the script is not working, I tried multiple ways to fix it and it's still not working. I tried putting print functions to the script and there are no prints in the dev console. Here is the code:
01 | local notDEBOUNCE = game.ReplicatedStorage.THETRUEANSWER.Value |
04 | notDEBOUNCE = game.ReplicatedStorage.THETRUEANSWER.Value |
07 | game.Players.PlayerAdded:Connect( function (plr) |
08 | plr.Chatted:Connect( function (msg) |
09 | msg = string.lower(msg) |
10 | if msg = = (string.lower( tostring (notDEBOUNCE))) then |
11 | if plr.SENDVERIFICATION.Value = = true and plr.SENDVERIFICATION 2. Value = = true then |
12 | plr.SENDVERIFICATION.Value = false |
13 | plr.SENDVERIFICATION 2. Value = true |
14 | plr.leaderstats.Stage.Value = 51 |
15 | plr.Character.Humanoid.Health = 0 |
19 | if plr.SENDVERIFICATION.Value = = true and plr.SENDVERIFICATION 2. Value = = true then |
20 | plr.SENDVERIFICATION.Value = false |
21 | plr.SENDVERIFICATION 2. Value = true |
22 | plr.leaderstats.Stage.Value = 50 |
23 | plr.Character.Humanoid.Health = 0 |