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

Command with shortcut doesn't work?

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

✓ Accepted answer

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)

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