Did anyone refer my script because i have tested it and its working
local player = game.Players.LocalPlayer
local state = false -- the gui is closed if its false
script.Parent.MouseButton1Click:Connect(function()
if not state then
wait(0.50)
player.PlayerGui.ScreenGui.Frame.Visible = true
script.Parent.Text = "Close Warning GUI"
state = true
else
player.PlayerGui.ScreenGui.Frame.Visible = false
script.Parent.Text = "Open Warning GUI"
state = false
end
end)