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

SurfaceGui Parenting help?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

So this script works on other surfaceguis but not this one, And I really don't know why

local SG = game:GetService("StarterGui")
local B = game.Workspace:WaitForChild("Tracker") or game.Workspace:FindFirstChild("Tracker")

game.Players.PlayerAdded:connect(function()
if B then
B.SurfaceGui = SG
SG.SurfaceGui.Adornee = B
end
end)

The only error I'm getting is

'SurfaceGui is not a valid member of Part' even though it clearly is http://prntscr.com/7i7osl

0
Ignoring the error that you're getting you're trying to say that a SurfaceGui is the StarterGui FearMeIAmLag 1161 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I think you need to do this:

  1. Transfer your SurfaceGui to StarterGui (ie make its parent game.StarterGui)
  2. Run game.StarterGui.SurfaceGui.Adornee = workspace.Tracker in the Command Bar
  3. Confirm that this does what you want; if so, delete the script

The reason you're getting that error is explained by FearMeIAmLag's comment. You can't reassign what the SurfaceGui is, you can only specify what you want to do with it (ex change its Parent or some other property, or run one of its functions).

Ad

Answer this question