Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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

Log in to vote
1
Answered by
Raccoonyz 1092 Donator Moderation Voter
4 years ago

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.

0
I dont understand how to do that... snipperdiaper 120 — 4y
0
Which gui, do you mean the scrolling frame??? snipperdiaper 120 — 4y
0
guiObject.Parent = ParentObject. beeswithstingerss 41 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

0
How exactly do I make it a parent Property? snipperdiaper 120 — 4y
0
Set the parent property by using "guiObject.Parent = game.Players.LocalPlayer.PlayerGui". youtubemasterWOW 2741 — 4y
0
I suppose in the local script, I'll try it tommorow, Thanks for helping!! snipperdiaper 120 — 4y
0
No problem. youtubemasterWOW 2741 — 4y
View all comments (11 more)
0
It didnt work..? snipperdiaper 120 — 4y
0
Hm. Any errors? Are you using a LocalScript? Where is the LocalScript located? youtubemasterWOW 2741 — 4y
0
I hope this is aloud, this picture will probably tell you https://gyazo.com/61b82ca1306b93f77ea943f81c643ffb snipperdiaper 120 — 4y
0
https://gyazo.com/a9377aa8ec41f755ecc72cfef1feff4f also this is the output bar shown when played snipperdiaper 120 — 4y
0
Try now. I've edited it. youtubemasterWOW 2741 — 4y
0
Also, those warnings are from the Roblox CoreScripts, so they don't have anything to do with your code. youtubemasterWOW 2741 — 4y
0
I dont understand, I added it to the local script, no errors no lag but still nothing snipperdiaper 120 — 4y
0
Are you playing in the studio "Run" mode or are you playing with a player "Play" mode? youtubemasterWOW 2741 — 4y
0
I use it in the play mode snipperdiaper 120 — 4y
0
But it wont even scroll in run mode snipperdiaper 120 — 4y
0
Hm. I do not know what is wrong. Sorry. youtubemasterWOW 2741 — 4y

Answer this question