Minecraft – How to /testfor if a player is sitting in a boat

minecraft-commandsminecraft-java-edition

I'm trying to prevent players from getting in boats. I'm thinking of a /testfor command attached with a clock that triggers a kill command. The thing is that I don't know how to write that /testfor command. I have searched google, but nothing relevant appears. Help me please!

Best Answer

try this command:
/testfor @p {Riding:{id:Boat}}