GetService() or script.Parent

If i insert a Script under StarterGui, should i do:

local starterGui = game:GetService("StarterGui")

or

local starterGui = script.Parent

I already have the Service because the Script is running, or?

None, you don’t access StarterGui, you access PlayerGui (basically the same but inside Player, they have the same content) and you get PlayerGui as game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")

1 Like

But the script is as a child in StarterGui, so it would not be the same like GetService?

Ah sorry i forgot, that starterGui copies the Assets into PlayerGui

No, StarterGui content is cloned into PlayerGui, the scripts are not activated first.

Yeah, i just forgot thoose thinks, thanks!

You would use script.Parent since it would be referencing PlayerGui.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.