How can I turn this script into DataStore 2?

I would suggest that you read the documentation for DataStore2:

DataStore2 isn’t a separate thing from Roblox datastores. It’s a user-made module that still uses the DataStoreService but has functionality to try to make saving things easier and prevent loss of data.