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

How would I fix this?

I am having trouble with cloning a GUI into a character would it be like this?

script.Parent.MouseButton1Down:connect(function()
	game.StarterGui.ScreenGui:Clone(game.Players.LocalPlayer.PlayerGui)
end)

1 comment

0

game.Workspace**

2 answers

✓ Accepted answer

Because Clone doesn't have any parameters.

workspace.Clone(parameters) --They do not have parameters, leave them empty.

Instead change the Clone's parent to the playergui

script.Parent.MouseButton1Down:connect(function()
    game.StarterGui.ScreenGui:Clone().Parent = game.Players.LocalPlayer.PlayerGui
end)

Hope it helps!

Actually, the clone function of game.Workspace can indeed take arguments. It would have to be set up a little differently than the way you have it, but it's nevertheless possible.

Example

the following would clone part and parent it the the workspace.

local clone = workspace.Clone
local part -- define as any unlocked or modifiable part/instance

clone(part).Parent = workspace

-- or

workspace.Clone(part).Parent = workspace

Code

script.Parent.MouseButton1Click:connect(function()
	workspace.Clone(game.StarterGui.ScreenGui).Parent = game.Players.LocalPlayer.PlayerGui
end)

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