Hey guys,
I’m trying to save a player’s TeamColor to a DataStore so that when they rejoin, they are on the same team, however, I keep getting an error.
12:11:16.226 104: Cannot store int in data store. Data stores can only accept valid UTF-8 characters. - Server - TeamSave:17
Here is my code, could the issue be the space in the TeamColor? If you all could help me out, that would be greatly appreciated.
Here is my code BTW, and I know I’m not using pcall, it really doesn’t make a difference to me.
local DataStoreService = game:GetService("DataStoreService")
local LevelSaves = DataStoreService:GetDataStore("Levels")
local Teams = game:GetService("Teams")
game.Players.PlayerAdded:Connect(function(plr)
local TeamColor = LevelSaves:GetAsync("TeamColor"..plr.UserId)
if TeamColor == nil then
plr.TeamColor = BrickColor.new("White")
print(tostring(TeamColor))
else
plr.TeamColor = BrickColor.new(tostring(TeamColor))
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local TeamToSave = plr.TeamColor
LevelSaves:SetAsync("TeamColor"..plr.UserId, TeamToSave)
end)
Thanks!