How do I put a player's name in a /title command?

So, long story short, I'm trying to have a title displayed so that it says something like, "CACox97 has won the game!" with the basic command like "@p has won the game!"

My command so far is (ran in command block):

titleraw @a title {"rawtext":[{"text":" ","extra":[{"selector":@p"}],"text":" has won the game!"}]}

If you try to run that command, it'll just say, " has won the game!"

I'm playing Bedrock Edition 1.11.4.


Solution 1:

This command will tell a random player what their name is:

/execute @r ~ ~ ~ title @s title Your name is @s