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

GUI not showing when inserted into PlayerGui?

Hi, I'm trying to get access to my GUI, so I can make changes, but I don't know how, because my script is located in StarterPack, because I'm making something with Tools, and I can't access StarterGui. I've tried inserting the GUI into the Player's PlayerGui which seems like the best option to do something like this, but it doesn't work. Can someone help?

Code:

local Tool = script.Parent
local GUI = Tool.GUI

Tool.Equipped:Connect(function()
  local Player = game.Players.LocalPlayer
  GUI.Parent = Player:WaitForChild("PlayerGui")
end)

4 comments

0

errors?

0

No errors for some reason, the output is empty.

0

GUI.Enabled = true

0

Hmmm, that doesn't work. And also, when I took away the Equipped event, there was an error in the output saying "attempting to index nil with PlayerGui"

1 answer

local Tool = script.Parent
local GUI = Tool.GUI

Tool.Equipped:Connect(function()
  local Player = game.Players.LocalPlayer
  GUI.Parent = Player:WaitForChild("PlayerGui")
  GUI.Enabled = true
end)

the gui needs to be a ScreenGui if it isn't put it in a ScreenGui

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