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

How to add GUI's manually to the CoreGui?

I am trying to add a gui to the CoreGui so it wont go away when a player resets. I am adding it to my admin, which is a module. So when a player joins, it clones the localscript into the players playergui so it executed the localscript which then adds the gui in their CoreGui.

But...

It doesn't work.

local s = Instance.new("ScreenGui", game.CoreGui)
local f = Instance.new("Frame", s)
f.Size = UDim2.new(1,0,1,0)
f.Position = UDim2.new(0,0,0,0)

I've seen people with GUIs where they dont go away, in scriptbuilder.. So it isnt in their startergui.

How do they make it so it doesn't go away?

5 comments

0

CoreGui is not accessible by normal scripts. CoreGui is often changed by exploits or while in studio through a plugin, however, the latter doesn't transfer over to the game. Might I suggest looking into the http://wiki.roblox.com/index.php?title=API:Class/StarterGui/ResetPlayerGuiOnSpawn

0

There's nothing on the page.

0

It's just a property to change. Either that or you could use a local script to copy elements of a player's gui as they are being replaced, once the player's character has respawned you could remove the replacement guis and place the clones in the Player's Gui.

0

oh. So I do like = true or = false on it

0

Is vvvvvvvvv A problem?

1 answer

local S = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
local F = Instance.new("Frame", S)
F.Size = UDim2.new(0,50,0,50)

game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false

This also does not work. When I respawn it removes the GUI ;( Any ideas to why?

2 comments

0

Here's an idea why: The GUI appears in your PlayerGui and it doesn't start in the StarterGui at the beginning of the game, meaning the StarterGui properties aren't applied..? This is purely speculation.

0

I think a fix, if I'm correct, is instead of using StarterGui, doing this: S.ResetOnSpawn = false

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