After my last question got answer (Which was very helpful btw) I want to know, how would I clone a ScreenGUI into starter gui and remove it from startgui when done. I need info like would it be a local or regular script and wiki links if possible. Thanks!
01 | Workspace.ScreenGUI:Clone().Parent = StarterGui --assuming its in Workspace after it gets cloned the |
02 | --clone is put in starter gui |
03 |
04 |
05 |
06 |
07 | function onClicked() |
08 | --stuff |
09 | --stuff |
10 | StarterGui.ScreenGUI:Remove() --gets removed at the end |
11 | end |
12 | StarterGui.ScreenGUI.MouseButton 1 Click:connect(onClicked) --when screengui is clicked go to function onClicked |
i am not sure if its going to be local or regular but i am leaning towards regular. http://wiki.roblox.com/index.php?title=RBX.lua.LocalScript_(Object)
clone method wiki link:http://wiki.roblox.com/index.php?title=Clone_(Method)&redirect=no
Heres a example, your information was very unformational, so I did this with your information.
1 | time = 1 |
2 |
3 | i = Instance.new( "ScreenGui" ) |
4 | i.Parent = game.ScreenGui |
5 | wait(time) |
6 | i:remove() |
I would do something like this
Example
1 | local waittime = 3 |
2 | function giveGUI(player) |
3 | if player and player.PlayerGui then |
4 | local gui = game.ServerStorage.Gui:clone() |
5 | gui.Parent = player.PlayerGui |
6 | wait(waittime) |
7 | gui:Destroy() |
8 | end |
9 | end |
Usage
1 | giveGUI(game.Players.Player 1 ) |