Need help with data saving

I’m trying to make a system where a player can save and load their character, but whenever I try to put some items in a table it doesn’t work.

local player = game:GetService("Players").LocalPlayer

local function getData()
	local data = {}
	data[player.Name] = {
		
		Shirt = player.Character:FindFirstChildWhichIsA("Shirt").ShirtTemplate,
		Pants = player.Character:FindFirstChildWhichIsA("Pants").PantsTemplate,
		ShirtGraphic = player.Character:FindFirstChildWhichIsA("ShirtGraphic"),
		Face = player.Character.Head:FindFirstChildWhichIsA("Decal").Texture
		
	}
	return data
end

script.Parent.MouseButton1Click:Connect(function()
	local dataToSave = getData()
	print(dataToSave[1])
end)

Does anyone know what I could possibly do to fix this?

1 Like

What is the print printing? Most likely a table.

No, it prints nil when I attempt to run the script

1 Like