Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

SurfaceGui Parenting help?

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

1 comment

0

Ignoring the error that you're getting you're trying to say that a SurfaceGui is the StarterGui

1 answer

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).

This discussion is preserved as it was. New answers, comments, and votes are closed.