These two functions DO work, but they both only work once. The first adds a GUI and the second removes it, but it will only work once. How do I make it work more than once?
script.Parent.ClickDetector.MouseClick:connect(function(player)
if not player.PlayerGui:FindFirstChild("ScreenGui") then
local sc = Instance.new("ScreenGui", player.PlayerGui)
wait(0.1)
local fr = Instance.new("Frame", sc)
fr.Size = UDim2.new(0, 100, 0, 100)
fr.Position = UDim2.new(0, 750, 0, 250)
end
end)
script.Parent.ClickDetector.MouseClick:connect(function(player)
if player.PlayerGui.ScreenGui.Frame.Visible == true then
player.PlayerGui.ScreenGui.Frame.Visible = false
end
end)
