Unable to assign property Source. ProtectedString expected, got string

Im trying to make a plugin that turns the object you have selected into lua code, everything is working as intended but when i try to convert a larger model it just prints this error
“Unable to assign property Source. ProtectedString expected, got string”

function fixString(str)
	return str:gsub("[%p%c%s]","")
function convert()
	local model = selection:Get()
	if #model > 1 then warn("Please select one model at a time.") return else model = model[1] end
	local Script = Instance.new("Script",model.Parent)
	local instanceCount = 0
	local fixedName = fixString(model.Name)
	ch:SetWaypoint("Added new script")
	local convertedProperties = ConvertInstance(model,instanceCount)
	local Source = "--"..model.Name.."--\n\nlocal "..fixedName.."_"..instanceCount.." = Instance.new(\""..model.ClassName.."\")"
	for i,v in pairs(convertedProperties) do
		Source = Source.."\n"..fixedName.."_"..instanceCount.."."..tostring(v)
	instanceCount += 1
	if #model:GetDescendants() > 0 then
		for i,dec in pairs(model:GetDescendants()) do
			if props[dec.ClassName] then
				fixedName = fixString(dec.Name)
				Source = Source.."\n\n--"..dec.Name.."--\n\nlocal "..fixedName.."_"..instanceCount.." = Instance.new(\""..dec.ClassName.."\")"
				local convertedProperties = ConvertInstance(dec,instanceCount)
				for i,c in pairs(convertedProperties) do
					Source = Source.."\n"..fixedName.."_"..instanceCount.."."..tostring(c)
				instanceCount += 1
	Script.Source = Source
	Script.Name = model.Name.." to lua"

I think the problem could be in there but if u need to know more just let me know

Fixed it by putting all the parts in a table, i dont know what the problem was but it worked

never mind its happening again

Did you ever find a solution? Having the exact same issue.