Spawning model with script and resizing?

Is it possible to have it where a player can type a ID and it would spawn the ID of the model but also resize the model? (GUI and Building is done, and Base is what the model would spawn on.
local insertService = game:GetService( "InsertService" )

local modelId = givenid local model = insertService:LoadAsset(modelId)`

model.Base

1 Like

Cool idea, but there are quite a few caveats. For example, most models on roblox are not open to the public, hence not able to load in other games and places than the creators.

So this is not possible is what I am getting?

Using GetProductInfo with the InfoType as Asset, you could check if IsForSale is true.

If so, you can insert it.

For your main question, it’d be tough to resize it though positioning it could be simple if it has a PrimaryPart set (or you could set one yourself)

So how would the overall script look like?

You CAN achieve this to an extent. If the asset has been uploaded by either Roblox, you, or your group (assuming that it’s a group game), you can insert it.

You can also resize a model, though that will require a good amount of math to accomplish that (which unfortunately, isn’t something I’m knowledgeable on). And yes, it’s possible to determine what base the model can spawn in.

I wrote psuedo-like code, which should hopefully give you an idea:

local InsertService = game:GetService("InsertService")

TextButton.MouseButton1Down:Connect(function()
	
	local good, returned = pcall(function()
		return InsertService:LoadAsset(TextBox.Text)
	end)
	
	if good then
		returned.Parent = workspace
		returned:MoveTo(base.Position)
	else
		-- Error handling here
	end
	
end)

Edit: Fixed small bug in code.

3 Likes

Alright, thanks a lot! Resizing will be very important due to the fact that players may spawn very huge models which is very unwanted…

1 Like