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

How would I fix this?

Asked by 9 years ago

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)
0
game.Workspace** Roblox_v10 33 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

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!

Ad
Log in to vote
1
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

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)

Answer this question