This is the script I tried (I'm still kinda new to scripting)
function onClicked() game.StarterGui.ScreenGui.Enabled = true wait(6) game.StarterGui.ScreenGui.Enabled = false end script.Parent.ClickDetector.MouseClick:connect(onClicked)
You have to access PlayerGui
, not StarterGui
. Also, use :Connect()
instead of :connect()
as it's deprecated.
local ClickDetector = script.Parent:WaitForChild("ClickDetector") -- Gets the ClickDetector local GUI_Name = "ScreenGui" -- Name of GUI local WaitTime = 6 -- Wait time before GUI wents off ClickDetector.MouseClick:Connect(function(player) local GUI = player:WaitForChild("PlayerGui"):WaitForChild(GUI_Name) -- Find's the GUI GUI.Enabled = true wait(WaitTime) GUI.Enabled = false end)