This is supposed to destroy the gui
function Play() game.StarterGui.ScreenGui.Parent.Parent.Parent:Remove() end script.Parent.MouseButton1Click:connect(Play)
Output:Players.Player1.PlayerGui.ScreenGui.Frame.TextButton.LocalS:2: attempt to index field 'Parent' (a nil value) What does that output mean?
On line two, you are attempting to ':Remove()' a nil value, heres what I mean;
Game StarterGui ScreenGui
Your script is trying to do this;
--A nil value/parent that does not exist Game --The parent of Game is nil StarterGui --The parent of StarterGui is Game ScreenGui --The parent of ScreenGui is StarterGui
You are attempting to remove a nil-like parent that does not exist, and if you removed the ScreenGui from StarterGui, then onReset, others won't beable to get the GUI, I'd do this instead;
local function Play() script.Parent.Parent:Destroy() end script.Parent.MouseButton1Down:connect(Play)
And heres how you'd do this in game;
Game StarterGui ScreenGui TextButton/ImageButton LocalScript
Hope this helped! :)