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

Output comes up with "RecipeGUI not a valid member of PlayerGui" anyone know what to do?

Asked by
bailley5 114
5 years ago
01local player = game.Players.LocalPlayer
02local gui = player.PlayerGui.RecipeGUI
03 
04gui.Parent = nil
05 
06script.Parent.Equipped:connect(function(mouse)
07    gui.Parent = player.PlayerGui
08end)
09 
10script.Parent.Unequipped:connect(function(mouse)
11    gui.Parent = nil
12end)

Anyone know why?

0
Is RecipeGUI inside PlayerGui before you equip the gun? Vid_eo 126 — 5y

1 answer

Log in to vote
1
Answered by
Vid_eo 126
5 years ago

I'm going to assume RecipeGUI isn't inside PlayerGui before the gun is equipped. That's probably where the error is coming from. Also, I would just keep RecipeGUI in PlayerGui at all times and just enable it when the tool is equipped:

01local player = game.Players.LocalPlayer
02local gui = player.PlayerGui.RecipeGUI
03 
04gui.Enabled = false --i would just do this directly from properties
05 
06script.Parent.Equipped:connect(function(mouse)
07    gui.Enabled = true
08end)
09 
10script.Parent.Unequipped:connect(function(mouse)
11    gui.Enabled = false
12end)

If this helped, please accept the answer :). If not, then comment what's not working and I'll try to help you.

0
Tysm! bailley5 114 — 5y
Ad

Answer this question