Multiattack. The Tyrannosaurus makes two attacks: one bite and one tail. It can't make both attacks against the same target
Bite. Melee weapon attack: +10 to hit, reach 10 ft, one target. hit: 4d12+7 piercing damage. If the target is a medium or smaller creature, it is grappled (escape DC 17). Until this grapple ends, the target is restrained, and the tyrannosaurus can't bite another target.
Tail. Melee Weapon Attack: +10 to hit, reach 10ft., one target. Hit: 3d8+7 bludgeoning damage.
the Tyrannosaurus can take 3 legendary actions, choosing from the options below. Only one legendary action option can be used at a time and only at the end of another creature's turn. The tyrannosaurus regains spent legendary actions at the start of its turn.
Entangle (2 actions): Grasping vines and roots sprout in a 10 foot radius around the tyrannosaurus. These wither after 1 minute. For the duration, that area is difficult terrain for non plant creatures. In addition any creature of the Tyrannosaurus' choice in that area when the plants appear must succeed on a DC 14 strength check or be restrained. A creature can use it's action to try to free itself or another restrained creature with the same strength check.
Tail attack.
the tyrannosaurus moves up to half its speed.