I'm trying to fix the Stamper tool from old Roblox. It should work as usual, but for some reason when I call :LoadAsset, it returns nil.

Can somebody please assist me? I want to make a building game.

Server script:

local InsertStuff = game:GetService('ReplicatedStorage').InsertStuff
local InsertService = game:GetService("InsertService")

InsertStuff.LoadAsset.OnServerInvoke = function(player, assetId)
	local asset = InsertService:LoadAsset(assetId)
	print(asset.Name)
	return asset
end

InsertStuff.LoadAssetVersion.OnServerInvoke = function(player, assetVersionId)
	return InsertService:LoadAssetVersion(assetVersionId)
end

Client script:

P.S. the client script has 3413 lines so i couldn't show all of it; I just showed the function where the problem lies.

	function StamperMain:LoadStampObject(stampObj,terrainShape)
		
		--[[WARNING, not using cacheing for terrain yet]]--
		if tonumber(stampObj.AssetId)==self.WaterAssetId then
			print('Loaded Water obj:'.. stampObj.AssetId)
			self.LastWaterObject = stampObj
			if not stampObj.Asset then
				stampObj.Asset = self.RbxStamper.GetStampModel(tonumber(stampObj.AssetId), terrainShape)
			end
			self:SetWaterProperties(stampObj.Asset,self.WaterGui:GetWaterData())
		elseif terrainShape and terrainShape>=0 then
			print('Loaded terrain obj:'.. stampObj.AssetId)
			stampObj.Asset = self.RbxStamper.GetStampModel(tonumber(stampObj.AssetId), terrainShape)
		elseif not stampObj.Asset then
			print('Loaded model obj:'.. stampObj.AssetId)
			stampObj.Asset = insertservicefolder:WaitForChild('LoadAsset'):InvokeServer( tonumber(stampObj.AssetId) ):GetChildren()[1] --where the problem is
			table.insert(self.ObjectCache, stampObj)
			if #self.ObjectCache > self.ObjectCacheSize then
				self.ObjectCache[1].Asset:Remove()
				--[[WARNING, Order n operation, replace with stack]]--
				table.remove(self.ObjectCache,1)
				print('removed object!')
			end
		end
	end

2 comments

0

Line 19 it's Destroy not Remove

0

i didn't write that code