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

I dont know how to copy frames into screen gui?

i am trying to make a game were you are clicking to make a frame (very weird) and i am trying to make that it would copy the frame from server storage and paste it into starter gui but it dosent work if u have any solution let me know

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local Object = game.ServerStorage.Dot
local copy = Object:Clone()


mouse.Button1Down:Connect(function()
	copy = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame
	copy.Position = UDim2.new(0,mouse.X - 10, 0,mouse.Y + 25 )
end)

2 answers

✓ Accepted answer

You should put your copy clone variable in the function so every time you click, it clones it instead of cloning ONLY ONCE

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local Object = game.ServerStorage.Dot


mouse.Button1Down:Connect(function()
    local copy = Object:Clone()
    copy.Parent = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame
    copy.Position = UDim2.new(0,mouse.X - 10, 0,mouse.Y + 25 )
end)

You also instead of defining copy clone's Parent, you instead redefined the copy variable as an Instance location. Hope that solves your issue! :)

Seems like you forgot to add ".Parent" in line 9

copy.Parent = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame

But if u need to copy your object more than once, u have to put

local copy = Object:Clone()

into function.

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