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)
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You have to access PlayerGui not StarterGui, and when doing anything with a gui it has to be done from a LocalScript. Also use :Connect as :connect is deprecated.