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

Roblox studio says BanGUI is not a valid member but there's an else? [solved]

Whenever I run the script, I keep getting this error:

15:49:13.197 - BanGUI is not a valid member of PlayerGui "Players.AbsurdAwesome101.PlayerGui"

This is the code:

script.Parent.Equipped:Connect(function()
	if lp.PlayerGui.BanGUI ~= nil then
		local gui = lp.PlayerGui.BanGUI
		local frames = gui:GetChildren()
		frames.Visible = true
	else
		script.Parent.BanGUI:Clone().Parent = lp.PlayerGui
	end
end)

this is inside a local script inside a tool. Legit no reason to be giving me errors, so whats wrong????

1 comment

0

Put if lp.PlayerGui:FindFirstChild("BanGUI") then

1 answer

Fixed.

script.Parent.Equipped:Connect(function()
	if lp.PlayerGui:FindFirstChild("BanGUI") ~= nil then
		local gui = lp.PlayerGui.BanGUI
		gui.BanModeToggle.Visible = true
		gui.BreakToggle.Visible = true
	else
		script.Parent.BanGUI:Clone().Parent = lp.PlayerGui
	end
end)

1 comment

0

Put [Solved] in the title of the question

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