I'm trying to make it so that when a Gui disappears, Ready sets to true (meaning that if you touch the part again, the gui will pop-up again). However, line 10 caused this error: "attempt to index nil with 'PlayerGui'".
Popup = script.Parent.DeleteGui ----- Your ScreenGUI's name Ready = true function onTouch(hit) local h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil and Ready == true then Ready = false local plyr = game.Players:FindFirstChild(h.Parent.Name) local c = Popup:clone() c.Parent = plyr.PlayerGui repeat wait() until game.Players.LocalPlayer.PlayerGui.DeleteGui == nil Ready = true end end script.Parent.Touched:connect(onTouch)
Can someone please help me fix this please?