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

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


local player = game.Players.LocalPlayer
local gui = player.PlayerGui.RecipeGUI

gui.Parent = nil

script.Parent.Equipped:connect(function(mouse)
    gui.Parent = player.PlayerGui
end)

script.Parent.Unequipped:connect(function(mouse)
    gui.Parent = nil
end)

Anyone know why?

1 comment

0

Is RecipeGUI inside PlayerGui before you equip the gun?

1 answer

✓ Accepted answer

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:

local player = game.Players.LocalPlayer
local gui = player.PlayerGui.RecipeGUI

gui.Enabled = false --i would just do this directly from properties

script.Parent.Equipped:connect(function(mouse)
    gui.Enabled = true
end)

script.Parent.Unequipped:connect(function(mouse)
    gui.Enabled = false
end)

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

1 comment

0

Tysm!

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