Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can a model get created if a GUI is clicked?

Asked by 8 years ago

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?

1 answer

Log in to vote
0
Answered by
Cesire 45
8 years ago

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)
0
I put the script in the ImageButton but the model didn't appear anywhere in the game when I clicked it. Any help? ToySackboyLBP2 0 — 8y
0
Are you sure the model is in your inventory & that you typed the Id correctly? Cesire 45 — 8y
0
The model is definitely in my inventory, and I copied & pasted the ID correctly. ToySackboyLBP2 0 — 8y
0
Hmm this is tricky, are you the creator of the model? Cesire 45 — 8y
View all comments (5 more)
0
Yes, I am the creator. Would it make a difference if it was a LocalScript instead? ToySackboyLBP2 0 — 8y
0
Maybe try it. Cesire 45 — 8y
0
It still doesn't work. ToySackboyLBP2 0 — 8y
0
Ok, I checked the ROBLOX Wiki and it turns out it is assetID instead of ID. It works now. Thanks for the help anyway. ToySackboyLBP2 0 — 8y
0
Sorry my bad, you need to set the parent of the inserted object, i forgot that. Cesire 45 — 8y
Ad

Answer this question