Filtering Enabled = true

Error:

20:41:22.443 - Can't parse JSON
20:41:22.451 - Stack Begin
20:41:22.453 - Script 'ServerScriptService.Store', Line 81
20:41:22.455 - Stack End

script:

local DataStore = game:GetService("DataStoreService")
local Ds1 = DataStore:GetDataStore("Characters")
game.Players.PlayerAdded:connect(function(Player)
	
	      local Gstuff = Instance.new("Folder",Player)
	      Gstuff.Name = "Gamestuff"
	      local Chars = Instance.new("Folder",Gstuff)
	      Chars.Name = "Characters"
	     local Create = Instance.new("Folder",Chars)
	      Create.Name = "Folder"
	local Hotbar = Instance.new("Folder",Chars)
	      Hotbar.Name = "AbilityHotBar"
	     local Energ = Instance.new("IntValue",Create)
	      Energ.Name = "Energy"
	      Energ.Value = 100
		local NumChars = Instance.new("IntValue",Chars)
	      NumChars.Name = "Number"
	     local BodyColors = Instance.new("BrickColorValue",Create)
	           BodyColors.Name = "BColors"
	           BodyColors.Value = BrickColor.new("Brick yellow")
	     local HairColor = Instance.new("BrickColorValue",Create)
	           HairColor.Name = "HairColor"
	           HairColor.Value = BrickColor.new("Buttermilk")
	     local HairId = Instance.new("StringValue",Create)
               HairId.Name = "HairId"
	           HairId.Value = "Bald"
	     local Shirt = Instance.new("StringValue",Create)
	           Shirt.Name = "Shirt"
	     local Pants = Instance.new("StringValue",Create)
	           Pants.Name = "Pants"
	     local Face = Instance.new("StringValue",Create)
	           Face.Name = "Face"
	           Face.Value = "rbxassetid://167133081"
	     local Gender = Instance.new("StringValue",Create)
	           Gender.Name = "Gender"
	           Gender.Value = "Male"
	 local Camera = Instance.new("StringValue",Gstuff)
	           Camera.Name = "Camera"
	           Camera.Value = "Start"
	     local Class = Instance.new("StringValue",Create)
	           Class.Name = "Class"
               Class.Value = "None"
	     local Exp = Instance.new("IntValue",Create)
	           Exp.Name = "Exp"
	           Exp.Value = 0
     	local MaxExp = Instance.new("IntValue",Create)
	           MaxExp.Name = "MaxExp"
	          MaxExp.Value = 100
	      local Level = Instance.new("IntValue",Create)
	           Level.Name = "Level"
	           Level.Value = 0
	     local Zeni = Instance.new("IntValue",Create)
	           Zeni.Name = "Zeni"
	           Zeni.Value = 0
	      local AbilOne = Instance.new("StringValue",Hotbar)
	           AbilOne.Name = "AbilityOne"
	          AbilOne.Value = "None"
	 local AbilTwo = Instance.new("StringValue",Hotbar)
	           AbilTwo.Name = "AbilityTwo"
	          AbilTwo.Value = "None"
	 local AbilThree = Instance.new("StringValue",Hotbar)
	           AbilThree.Name = "AbilityThree"
	          AbilThree.Value = "None"
	 local AbilFour = Instance.new("StringValue",Hotbar)
	           AbilFour.Name = "AbilityFour"
	          AbilFour.Value = "None"
	 local AbilFive = Instance.new("StringValue",Hotbar)
	           AbilFive.Name = "AbilityFive"
	          AbilFive.Value = "None"
	 local Emote = Instance.new("StringValue",Hotbar)
	           Emote.Name = "Emote"
	          Emote.Value = "None"
	 local Item = Instance.new("StringValue",Hotbar)
	           Item.Name = "Item"
	          Item.Value = "None"
	 local Amount = Instance.new("IntValue",Item)
	           Amount.Name = "Amount"
	            Amount.Value = 0
	
	 local key = "Player-"..Player.userId
	 local SavedValues = Ds1:GetAsync(key)
	
	 if SavedValues then
		--Save Format -- {BodyColors,HairColor,HairId,Shirt,Pants,Face,Gender,Class,Level,NumChars,Zeni,Exp}
		BodyColors.Value = BrickColor.new(SavedValues[1])
		HairColor.Value = BrickColor.new(SavedValues[2])
		HairId.Value = SavedValues[3]
		Shirt.Value = SavedValues[4]
		Pants.Value = SavedValues[5]
		Face.Value = SavedValues[6]
		Gender.Value = SavedValues[7]
		Class.Value = SavedValues[8]
		Level.Value = SavedValues[9]
		NumChars.Value = SavedValues[10]
		Zeni.Value = SavedValues[11]
		Exp.Value = SavedValues[12]
		MaxExp.Value = SavedValues[13]
		AbilOne.Value = SavedValues[14] 
		AbilTwo.Value = SavedValues[15]
		AbilThree.Value = SavedValues[16]
		AbilFour.Value = SavedValues[17]
		AbilFive.Value = SavedValues[18]
		Item.Value = SavedValues[19]
		Emote.Value = SavedValues[20]
		Amount.Value = SavedValues[21]
	else 
		local ValuesToSave = {BodyColors.Value.Name,HairColor.Value.Name,HairId.Value,Shirt.Value,
		Pants.Value,Face.Value,Gender.Value,Class.Value,Level.Value,NumChars.Value,Zeni.Value,Exp.Value,
		MaxExp.Value, AbilOne.Value, AbilTwo.Value, AbilThree.Value, AbilFour.Value, AbilFive.Value, Item.Value, 
		Emote.Value, Amount.Value}
		Ds1:SetAsync(key, ValuesToSave)
	end
	
	end)

6 comments

0

Make sure you do not save any roblox objects. For example it looks like you try to save BrickColors for BodyColor and HairColor. Hard to tell.

0

Im saving BrickColor3 Values

0

Yeah, you have to convert that to a string to save it in datastore.

0

@cabbler no, You can create a brick colour using its string name only.

0

You may need to wipe the existing data but this is a strange error as the table conversion is managed internally by roblox

0

how do i wipe it?