String expected, got boolean

I have a string as my datastore but I don’t know why its getting a boolean

local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("RaceData")
local ds2 = datastore:GetDataStore("EdictData")
local ds3 = datastore:GetDataStore("FaceData")

game.Players.PlayerAdded:connect(function(plr)
 local folder = Instance.new("Folder", plr)
 folder.Name = "Data"
 local points = Instance.new("StringValue", folder)
 points.Name = "Race"
 local survivals = Instance.new("StringValue", folder)
	survivals.Name = "Edict"
	
	local Face = Instance.new("NumberValue",folder)
	Face.Name = "Face"
	
 
 points.Value = ds1:GetAsync(plr.UserId) or "N/A"
 ds1:SetAsync(plr.UserId, points.Value)
	
	Face.Value = ds3:GetAsync(plr.UserId) or 0
	ds3:SetAsync(plr.UserId, Face.Value)
	
	
 survivals.Value = ds2:GetAsync(plr.UserId) or "N/A"
 ds2:SetAsync(plr.UserId, survivals.Value)
 
 points.Changed:connect(function()
  ds1:SetAsync(plr.UserId, points.Value)
	end)
	
	Face.Changed:connect(function()
		ds3:SetAsync(plr.UserId, Face.Value)
	end)
	
 
 survivals.Changed:connect(function()
  ds2:SetAsync(plr.UserId, survivals.Value)
 end)
end)

Which line?
Can you please provide more details, example screen shot of the error and at which line this error is causing.

image
The line is this one
image

Try replacing it to the string, by using toString()

points.Value = tostring(ds1:GetAsync(plr.UserId)) or "N/A"

If you dont want it to be bool value, then re-check your saving script.
Its saving bool value instead of your string.

1 Like