OctaLua is right.
Your GUI is on client, the object seem to be in workspace.
On click, get the player, find the GUI component inside the player GUI and set.Visible = false
BTW, you speak spanish? I say it due to Emergencia and Boton.
Would be easier for me to explain in spanish xD
BTW. You need to change the Visible in LocalScript, use a remote event from the Object click detector, to send a remote event to the LocalScript inside player’s GUI
Primero crea un evento remoto dentro de ReplicatedStorage nombralo “hideGui”
Crea una parte en Workspace y crea un Script dentro de la parte, tambien un ClickDetector.
Despues pon un LocalScript dentro del ScreenGui, y pon un Frame tambien
En el script del server osea el del objeto pon esto:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local hideRem = ReplicatedStorage:WaitForChild("hideGui")
local click = script.Parent.ClickDetector
local function disableGUI(player)
print("disable GUI")
hideRem:FireClient(player)
end
click.MouseClick:Connect(disableGUI)
Y en el LocalScript dentro del ScreenGui pon:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local hideRem = ReplicatedStorage:WaitForChild("hideGui")
local frame = script.Parent.Frame
local function hide()
if frame.Visible then
frame.Visible = false
else
frame.Visible = true
end
end
hideRem.OnClientEvent:Connect(hide)
It says attempt to index nil with 'PlayerGui' because the parent of PlayerGui doesn’t exist, you’re indexing something that doesn’t exist. You should more than likely take it slow.
local Players = game:GetService("Players");
local client = Players.LocalPlayer;
local PlayerGui = client:FindFirstChild("PlayerGui");
if PlayerGui then
PlayerGui.Emergencia.Emergenci.ImageTransparency = 0;
wait(5);
PlayerGui.Emergencia.Emergenci.ImageTransparency = 1;
end
Also in the error it says that it’s a ‘Script’ instead of a ‘LocalScript’, you cannot access LocalPlayer on a general script, which is why the parent of PlayerGui doesn’t exist and is nil; LocalPlayer can’t be accessed via general scripts.