Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to set Screen Gui appear for only a certain amount of time?

So I was messing around on roblox studio, i'm trying to make a thriller/horror with voiceovers and everything. Here's my main problem though... I made a click detector on a part (which in the game is like a page) and when you click it, it pops up the Gui (where you can read the page). Thing is though I don't want people to be able to exit it whenever they want because I'm going to add a voice over reading the note. So how would I make it (depending on how ever long the voice over is) close after that time period? Here's the script


function onClick(click)


for i,v in pairs (script.Parent:GetChildren()) do


if v.ClassName == "ScreenGui" then


c = v:Clone()

 

c.Parent = click.PlayerGui


end


end


end


script.Parent.ClickDetector.MouseClick:connect(onClick)

1 answer

✓ Accepted answer

function onClick()
for i,v in pairs (script.Parent:GetChildren()) do
if v.ClassName == "ScreenGui" then
c = v:Clone()
c.Parent = click.PlayerGui
wait(TIME_TO_STAY_ON_SCREEN)
c:Destroy()
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClick)


This discussion is preserved as it was. New answers, comments, and votes are closed.