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

What is a model's Parent after being loaded in using InsertService?

In this script, I am trying to determine if the model is already in the player's workspace (not workspace, though, because that's not exactly where models from InsertService go). But I need to know where they actually go so I can change line 5 when it's looking the object.

model=game:GetService("InsertService"):LoadAsset("892228363")

function onTouched(hit)
	
local found = game.Workspace:FindFirstChild("model")
if found then 
	print("already here")
else
model.Parent=game.Workspace
end	
end
workspace.touchthis.Touched:connect(onTouched)

Thanks <]:^)

1 answer

The parent of insertservice is Model. So you can just Model:GetChildren() and parent all of that to the desired place. Also with the local variable 'found' when it's being inserted it uses a capital 'm' so it would be

model=game:GetService("InsertService"):LoadAsset("892228363")

function onTouched(hit)

local found = game.Workspace:FindFirstChild("Model")
if found then 
    print("already here")
	for I,v in pairs(found:GetChildren()) do
	v.Parent = where_ever_you_want_to_put_it
end
else
model.Parent=game.Workspace
end 
end
workspace.touchthis.Touched:connect(onTouched)

Also InsertService will not work if you don't own the place and the model you are trying to insert is not in your inventory. But if it's gear then you would no problem.

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