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

GUI not showing when inserted into PlayerGui?

Asked by 4 years ago
Edited 4 years ago

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)
0
errors? Dan_PanMan 227 — 4y
0
No errors for some reason, the output is empty. gamernight687 138 — 4y
0
GUI.Enabled = true PepeElToro41 132 — 4y
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" gamernight687 138 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
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

Ad

Answer this question