I'm currently making a game that heavily uses TextButton GUIs and ImageButton GUIs. How can I get a model to be placed into the game if an ImageButton GUI is clicked?
COMMUNITY QUESTION
How can a model get created if a GUI is clicked?
1 answer
I assume your model is uploaded on the website. And that the script is a child of the ImageButton
script.Parent.MouseButton1Click:connect(function()
local Id = 1 -- Replace 1 with your model Id.
game:GetService("InsertService"):LoadAsset(Id).Parent = game.Workspace
script.Parent.Active = false
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

9 comments
I put the script in the ImageButton but the model didn't appear anywhere in the game when I clicked it. Any help?
Are you sure the model is in your inventory & that you typed the Id correctly?
The model is definitely in my inventory, and I copied & pasted the ID correctly.
Hmm this is tricky, are you the creator of the model?
Yes, I am the creator. Would it make a difference if it was a LocalScript instead?
Maybe try it.
It still doesn't work.
Ok, I checked the ROBLOX Wiki and it turns out it is assetID instead of ID. It works now. Thanks for the help anyway.
Sorry my bad, you need to set the parent of the inserted object, i forgot that.