script.Parent.MouseButton1Click:Connect(function(player)
local Gui = player.PlayerGui:WaitForChild("Gui")
Gui.Enabled = false
end)
attempt to index nil with 'PlayerGui'
How to fix this?
script.Parent.MouseButton1Click:Connect(function(player)
local Gui = player.PlayerGui:WaitForChild("Gui")
Gui.Enabled = false
end)
attempt to index nil with 'PlayerGui'
How to fix this?
Use this instead.
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local Gui = player.PlayerGui:WaitForChild("Gui")
Gui.Enabled = false
end)
Is this script inside if the gui? If it is, the edit your script to this:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Enabled = false
end)
Is assumed that you are clicking a text/imageButton inside of a frame inside the gui
This discussion is preserved as it was. New answers, comments, and votes are closed.