So I tried making a script where when you interact with an npc a gui appears but it keeps showing me this error in the Output.
Here's the script :
1 local TemplatesPart = script.Parent
2 local Temp = game.Workspace.Templates
3
4 TemplatesPart.ProximityPrompt.Triggered:Connect(function(player)
5 local open = false
6 local PlayerGui = player:WaitForChild("PlayerGui")
7 local ScreenGui = PlayerGui:WaitForChild("ScreenGui", 1)
8 local Frame = ScreenGui.Frame
9
10 if open == false then
11 open = true
12 Frame.Visible = true
13 else
14 open = false
15 Frame.Visible = false
16
17 end
18 end)

9 comments
try debugging with a print. On line 9 you can put if PlayerGui:FindFirstChild("Frame") then print("working") end
I tried and still says Workspace.Templates.Torso.Attachment.Prompt:8: attempt to index nil with 'Frame'
If you check the output does it print "working"?
Nope.
Alright, in that case the problem is that you aren't setting the Variable correctly. Check workspace and make sure that you have Frame parented to the ScreenGui. Also make sure that the frame is named "Frame".
Somehow it started working again! I think it was because the ScreenGui was named 'shop'?
Thank you!
No problem. If you're confused as to why that wouldn't work, I believe its because you set local ScreenGui to PlayerGui:WaitForChild("ScreenGui"). This means that the value will be nil if the ScreenGui was named "Shop"
Ooooh I get it now.