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

My GUI cloning script wont clone the gui under the original?

I tried my best, It shows now errors but It just wont clone it

while true do
	
 wait(0.2)
	local guiObject = script.Parent:Clone() -- creates a clone of parent
	
	guiObject.Position = UDim2.new(0,0, 0.2,0.1)
	
	wait(0.2)
	
end

If you need anymore information heres a gyazo about how it looks right now

https://gyazo.com/f0ff64db533a03efbbe4a22bc8522530

I read the guidelines and only heard about bad links. if this isn't allowed, I am sorry :)

2 answers

What you need to do is parent "guiObject" to the player's gui.

You are cloning it, but when you clone it is not actually ingame. The same applies to Instance.new() and many other similar functions.

3 comments

0

I dont understand how to do that...

0

Which gui, do you mean the scrolling frame???

0

guiObject.Parent = ParentObject.

Hello. Here is a more explained version of Raccoonyz's answer.


When a player is added, an object/instance gets created inside the player called PlayerGui. It is the container for the guis the player has on-screen. The guis that get cloned are inside StarterGui, another container.

So, you must parent the cloned gui to the PlayerGui.


Also, you must first create a ScreenGui and then put the object in it as TextLabels that aren't parented to a ScreenGui will not show up on-screen.


Add this code to the script (make sure it's a LocalScript):

game.Players.LocalPlayer:WaitForChild("PlayerGui") -- Waits for the PlayerGui to load

while true do
	wait(0.2)
	local screenGui = Instance.new("ScreenGui")


	local guiObject = script.Parent:Clone() -- creates a clone of parent

	guiObject.Position = UDim2.new(0,0, 0.2,0.1)
	
	guiObject.Parent = screenGui

	screenGui.Parent = game.Players.LocalPlayer.PlayerGui

	wait(0.2)
end


Also, when you use Clone(), the object is made but not parented. To parent it, you must use the "Parent" property.

15 comments

0

How exactly do I make it a parent Property?

0

Set the parent property by using "guiObject.Parent = game.Players.LocalPlayer.PlayerGui".

0

I suppose in the local script, I'll try it tommorow, Thanks for helping!!

0

No problem.

0

It didnt work..?

0

Hm. Any errors? Are you using a LocalScript? Where is the LocalScript located?

0

I hope this is aloud, this picture will probably tell you https://gyazo.com/61b82ca1306b93f77ea943f81c643ffb

0

https://gyazo.com/a9377aa8ec41f755ecc72cfef1feff4f also this is the output bar shown when played

0

Try now. I've edited it.

0

Also, those warnings are from the Roblox CoreScripts, so they don't have anything to do with your code.

0

I dont understand, I added it to the local script, no errors no lag but still nothing

0

Are you playing in the studio "Run" mode or are you playing with a player "Play" mode?

0

I use it in the play mode

0

But it wont even scroll in run mode

0

Hm. I do not know what is wrong. Sorry.

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