How would I not use a string for this

I wanna save clothes but I don’t know how because I would have to save the shirt template

The error is 103: string is not allowed for datastores.

Code (sorry that its really messy I’ve never used datastores before)

remote = game.ReplicatedStorage.SaveAvatar
dss = game:GetService("DataStoreService")
avatarStore = dss:GetOrderedDataStore("avatarStore")

debounce = false

function TeleportAndSave(player,Clothes)
local button = player.PlayerGui.CharacterCustomization.Frame.Confirm
	if debounce == false then
		button.Text = ("Loading..")
		debounce = true
				print(player.Name..("'s data is.. "),Clothes)
					for ClothesNumber,ClothesItem in pairs(Clothes) do
						local success, errorMessage = pcall(function()
							avatarStore:SetAsync(player.UserId,Clothes[ClothesNumber])
							print(avatarStore:GetSortedAsync(player.UserId))
						end)
					if not success then 
				warn(("Error.. ")..tostring(errorMessage))
			button.Text = ("Error, try again")
				task.wait(3)
				debounce = false
			button.Text = ("Confirm")
			break
			end
		end
	elseif debounce == true then
		warn("Debounce!")
	end
end

remote.OnServerEvent:Connect(TeleportAndSave)

If I’m not wrong, some characters in strings to use in data stores are not allowed.

1 Like

Yeah I saw that error once but it went away I forgot how tho

Anyways the thing I’m trying to save is

Perhaps you could just save the numbers in the asset link?

1 Like

How would I do that? Im not too good at string stuff

Easiest way is just to just do

local url = "https://www.roblox.com/assets/?id=123456789"
local id = string.match(url, "%d+")

print(id) --Expected output: "123456789"

image

2 Likes

avatarStore:SetAsync(player.UserId,Clothes[ClothesNumber]) -- Just save ID here
local clothing = "http://www.roblox.com/asset/?id=" .. avatarStore:GetAsync(player.UserId) -- Load player data like this

1 Like

Im still working on the new script will solution if it works