Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Could instance.new spawn any models instead of blocks?

Some examples is that you want to spawn a model every time someone clicks a button. If instance.new wouldn’t work then is there another way?

3 answers

✓ Accepted answer

Yes. There is a service named InsertService, and can be used to Insert Models, Meshes, etc.

Code for InsertService:

local InsertService = game:GetService("InsertService")
local id = -- your id --
local Model = InsertService:LoadAsset(id)
Model.Parent = workspace

If this doesn't work, alert me.

2 comments

0

Thx

0

Also this should be server sided if you want the changes to appear to everyone... so yea

Cloning to be exact. Have whatever model you want to clone in Replicated Storage First, you would have your click event then inside the code you want to define your model and clone it like this:

local item = game.ReplicatedStorage.item
local clickDetector = script.Parent

local function spawnitem()
	local spawning = item:Clone()
	spawning.Parent = game.Workspace
end


clickDetector.MouseClick:Connect(function()
	spawnitem()
end)

Edit script if needed.

1 comment

0

Also quick solution here also you can just connect the spawnitem function to the event

You could put the module you want to insert in server storage and then copy/paste in this code into the script:

function insert ()
local copy = game.ServerStorage.InsertItemNameHere:Clone()
copy.parent = game.workspase
end

script.parent.MouseButton1Click:Connect(insert)

This discussion is preserved as it was. New answers, comments, and votes are closed.