Getting Error When Trying to Enable Shop GUI

  1. What do you want to achieve? I am trying to enable a shop GUI when a player presses an on-screen button.

  2. What is the issue? I keep getting the error:

Players.hfun6.PlayerGui.DonationPrompt.TextButton.OpenShop:5: attempt to index nil with ‘Enabled’

  1. What solutions have you tried so far? I have tried using MouseButton1Click instead of activated.

Here is the LocalScript (which is in the gui button):

local plr = game.Players.LocalPlayer
local shop = plr.PlayerGui:FindFirstChild("Shop")
script.Parent.Activated:Connect(function()
	
	shop.Enabled = true
	
end)

What’s the ClassName of the shop?

It is just named “Shop” and is a ScreenGui.

I’m pretty sure TextButtons are MouseButton1Click, not Activated?

Also, if that doesn’t work, try using WaitForChild on the ship instead of FindFirstChild.

WaitForChild fixed it! Thank you :grinning:!