Datastore Issue

This is my script:

local DataService = game:GetService("DataStoreService")
local DataStore = DataService:GetDataStore("ObbySaver")

game.Players.PlayerRemoving:Connect(function(player)

     local teamName = player.Team

     DataStore:SetAsync(player.UserId.."-stage",teamName)

end)

It returns with the error:
Cannot store instance in data store. Data stores can only accept valid UTF-8 characters

player.Team is an Instance. Use player.Team.Name to get the name of that instance.

2 Likes