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

Adding and removing a gui?

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!

3 answers

✓ Accepted answer
Workspace.ScreenGUI:Clone().Parent=StarterGui --assuming its in Workspace after it gets cloned the
--clone is put in starter gui

 


function onClicked()
--stuff
--stuff
StarterGui.ScreenGUI:Remove()--gets removed at the end
end
StarterGui.ScreenGUI.MouseButton1Click: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

7 comments

0

I'll try it, thanks!

0

No problem ,just doing my job.

0

also for my script it removes the gui when you click on that gui

0

Where do I place the script, also can I have wiki links to where you got this info?

0

place the script in Workspace or serverscriptstorage

0

watch codeTheorem roblox game development series he got me started here is the link: https://www.youtube.com/user/bballer13snTV/playlists

0

serverscriptstorage would reduce lag if you used it

Heres a example, your information was very unformational, so I did this with your information.

time = 1

i = Instance.new("ScreenGui")
i.Parent = game.ScreenGui
wait(time)
i:remove()

5 comments

0

What I mean is that I have a Gui in StarterGui and I need a script that can remove it after I click a certain button on that gui

0

... Asking for something isnt right, if you know how to do it I will answer, your asking for scripts, you don't need help..

0

I was asking for wiki links -,-

0

BTW, time is a horrible variable to set as it is a built in function.

0

Its a example...

I would do something like this

Example

local waittime=3
function giveGUI(player)
if player and player.PlayerGui then
local gui=game.ServerStorage.Gui:clone()
gui.Parent=player.PlayerGui
wait(waittime)
gui:Destroy()
end
end

Usage

giveGUI(game.Players.Player1)

2 comments

0

The code is great and all guys but if you could simply give me wiki links to where you get this data that would be great so I can implement it in in my own way, also should this be a localscript and does it have to be in serverstorage if I made a different script that does this?

0

It's just application of prior knowledge, in my opinion.

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