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

GUI not being cloned?

Hello, I am making a Term for a group. So there is a model Called Term (Which is in Workspace). Inside there is a part called as Beam and inside the beam there is a script called as Script. So inside the script there is an GUI. The GUI tells how much time is left or who won and all. I created a separate local script and added this command.

local player = game.Players.LocalPlayer.PlayerGui
gui = script.Parent.Script.CaptureGUI:Clone()
gui.Parent = player

But sadly, It does not copy it. There is a no error in the output. Can someone tell me the problem? The name of the GUI is correct. If you could can answer as fast as possible it would help me out :)

2 answers

script.Parent.Script.CaptureGUI:Clone().Parent = game.Players.LocalPlayer.Playergui

1 comment

0

Not working :/

It could be that PlayerGui is not loading in time, the occupation of :WaitForChild A redundant method, could help.

local player = game.Players.LocalPlayer:WaitForChild("PlayerGui")
gui = script.Parent.Script.CaptureGUI:Clone()
gui.Parent = player

If this doesn't seem to work, try rechecking your code syntax.

4 comments

0

From what PlayingOBC described it seems the script is a descendant of PlayerGui, so waiting for that is unlikely to cause a difference.

0

Its not working

0

I got an output: 15:50:20.051 - Workspace.Raid System.RaidSystemV1.Script:1: attempt to index field 'LocalPlayer' (a nil value)

0

its super late but u probably wrote local player togetehr xd

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