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

How do I spawn a model with a button on a surface gui?

Asked by 9 years ago

How would I do it? I have tried every way. You see I'm not the best at this stuff, appreciated if you help me though.

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

I'm not sure 100% what your question means, but your going to need to use Instance.new in order to spawn the objects.

The API Instance.new has two arguments. The first being the object, and the second (optional) argument is the Parent.

Instance.new(object, parent)

Thus, you can do something similar to this in order to create the objects you need to create:

-- Declaring variables
local part = Instance.new('Part')
local surfacegui = Instance.new('SurfaceGui', part)
local frame = Instance.new('Frame', surfacegui)

--Editing created instances
part.Size = Vector3.new(5, 5, 5)
surfacegui.CanvasSize = Vector2.new(100, 100)
frame.BackgroundColor3 = Color3.new(80/255, 60/255, 100/255)
Ad

Answer this question