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

With a script, how can you insert something, and place it's parent?

Asked by
Scythax 35
10 years ago

With a script, how do you give it a parent, like a GUI,

Say you inserted a ScreenGui, and you want to put a frame inside of the ScreenGui. Would you do it this way?

local s = instance.new("ScreenGui")
local f = instance.new("Frame",ScreenGui)

Is that a way to do it? Is it like inserting a brick into workspace from script?

2 answers

Log in to vote
1
Answered by 10 years ago

Indeed, that is the correct way. But you would not be able to see it as you have not set the ScreenGui a parent:

also, ScreenGui's would be put in the PlayerGui's, so here's the correct script

player = game.Player.LocalPlayer
s = Instance.new("ScreenGui", player.PlayerGui) --Puts a ScreenGui in the PlayerGui
f = Instance.new("Frame", player.PlayerGui.ScreenGui) --Puts a Frame, inside the ScreenGui, which is inside the PlayerGui
0
For the second parameter of the second Instance.new call, you can just use 's', since that ScreenGui is already defined as that variable. adark 5487 — 10y
0
true. either way works fahmisack123 385 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago
local s = instance.new("ScreenGui",Workspace)
local f = instance.new("Frame",ScreenGui)

That should do it :)

Answer this question