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

Command with shortcut doesn't work?

Asked by 4 years ago
game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        local testM = "test"
        if msg == string.match(testM, "%w+") then
            print(msg)
        end
    end)
end)

I am trying to make a command shortcut When player types like "te" it does "print(msg)"

Im new to string.match so can someone help me, please?

1 answer

Log in to vote
1
Answered by
Prestory 1395 Moderation Voter
4 years ago
Edited 4 years ago

Here this should work

game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        local testM = "test"
        if msg == string.sub(testM, 1,2)  then
            print(msg)
        end
    end)
end)
Ad

Answer this question