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

Is it safe not parenting an instance to anything?

Asked by 5 years ago

So I am working with viewport frames and I . noticed that I don't need to parent the Camera to anywhere and still set the CurrentCamera of the ViewportFrame using the variable

But I was wondering if this is safe

I want to do this to make it non complicated if you know what I mean

Basically this

local Camera = Instance.new('Camera')
local Viewport= Instance.new('ViewportFrame')

Viewport.Parent = script.Parent -- Frame
Viewport.CurrentCamera = Camera -- Using the variable 

But does this all stack up

0
Roblox won't suddenly destroy the instance if its parented to nil. Otherwise, any code using Instance.new would break because the object is parented to nil. hiimgoodpack 2009 — 5y

Answer this question