(Not removing the GUI by clicking on it)
I'm a programmer who usually scripts in Python, and I'm trying to teach myself how to script Lua so that I can start work on making ROBLOX games. I've been fiddling around with GUI's and I put this in.
wait (20) game.startergui.ScreenGui:Remove()
I've also done a few variations of that code and things similar, and yet it still does not work too good. Anyone know what I may be doing wrong?
Change Remove() to Destroy(), a few helpful things ; You can also use PlayerGui
and set variables with local
for example
if the script was a LocalScript
inserted in StarterPlayer.StarterPlayerScripts
local plr = game.Players.LocalPlayer local gui = plr.PlayerGui:WaitForChild("ScreenGui") function removegui() gui:Remove() end wait(20) removegui()
in the example shown above, we name a function and put inside it what we want to do when we call it. then , we end the function and after ending it, as you said you wanted to wait x seconds then remove the gui
. This script does exactly so!
Time = 10
wait(Time) game.Players.LocalPlayer.PlayerGui.ScreenGui:Destroy()