So I made an Intro gui thats just a ImageLabel with a X button I made with the TextButton. I looked up a tutorial but the script didnt work for me when I tried to click the X.
script.Parent.MouseButtonClick:connect(function()script.Parent.Parent.Visible=false end)
its .MouseButton1Click your organization is also messed up
script.Parent.MouseButton1Click:Connect(function(lol) script.Parent.Parent.Visible = false end)
Referencing GingeyLol, this is another way to do it using input:
UIS = game:GetService("UserInputService") while true do wait() if UIS:IsKeyDown(Enum.KeyCode.O) then -- Open GUI for _,p in pairs(game.Players:GetPlayers()) do p.PlayerGui.ScreenGui.Enabled = true end end if UIS:ISKeyDown(Enum.KeyCode.X) then -- Close GUI if game.StarterGui.ScreenGui.Enabled ~= false then for _,p in pairs(game.Players:GetPlayers()) do p.PlayerGui.ScreenGui.Enabled = false end end end end
Ok, so I think I understand what you need.
First off, you need to put it in a local script. (Always a local script if it's in the StarterGui)
After that, you may want to destroy the gui completely. Using a simple method, you can do this efficiently.
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent:Destroy()
Hope this helped.
Sincerely, 222ono222
myScreenGui = script.Parent -- you're path
game.Players.PlayerAdded:Connect(function(player)
if not player then repeat wait() until game.Players.LocalPlayer end
player.CharacterAdded:Connect(function(character)
if not character then repeat wait() until player.Character end
if not player:FindFirstChild("PlayerGui") then repeat wait until player.PlayerGui end
for i,v in pairs(player.PlayerGui:GetChildren()) do
if v.Name == myScreenGui.Name then
ScreenGui = v
else
return
end
end
if character.Humanoid.Died:Wait() then
character.Humanoid.Died:Connect(function()
if ScreenGui.ResetOnSpawn == false then ScreenGui.ResetOnSpawn == true
end
if ScreenGui.ResetOnSpawn == true then