Are there benefits to reducing the amount of Instances which a script has to travel to? For example better script performance?

local GUI = Player.PlayerGui.ScreenGui.Frame
GUI.TextButton1.Text = "Hello!"
GUI.TextButton2.Text = "World!"

OR

Player.PlayerGui.ScreenGui.Frame.TextButton1.Text = "Hello!"
Player.PlayerGui.ScreenGui.Frame.TextButton2.Text = "World!"

4 comments

2

Yes, but A) this would be negated by doing f = Player.PlayerGui.ScreenGui.Frame or whatever B) you would never, ever, ever notice the difference.

0

Thank you once again!

0

mark as solved plz

0

There would be a minor difference as it doesn't have to index objects as many times (assuming Roblox didn't add optimizations.) However, it wouldn't/shouldn't be that significant for you to always attempt to reduce the amount of times you index objects.