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

Clone Frame By TextButton Click?

So Hello I want to make if player clicks the textbutton its will clone Frame From ReplicatedStorage To Gui. Attempt

local Costume1 = game.ReplicatedStorage.Costume1

script.Parent.MouseButton1Click:Connect(function()
game:GetService("ReplicatedStorage").Costume1:clone().Parent = game.Players

2 answers

✓ Accepted answer

Hi MrLordFearLT, you can use this instead of your current script. Also :clone() is deprecated use :Clone().

-- Local Script

local NameGUI = "Costume1" -- Name of your GUI inside ReplicatedStorage.

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local GUI = ReplicatedStorage:WaitForChild(NameGUI)

local Player =game.Players.LocalPlayer

function Clicked()
local copy = GUI:Clone()
copy.Parent = Player.PlayerGui
end

script.Parent.MouseButton1Click:Connect(Clicked)

1 comment

0

Approved!

Try this!

Local Costume1  = game.ReplicatedStorage.Costume1
script.Parent.MouseButton1Click:Connect(function()
local clone = Costume1:Clone
clone.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
end)

6 comments

0

Not that good at scripting but I tried. Lol

0

first line will make an error, lua is case sensitive.

0

you realize when you downvote, you are basically losing reputation too...?

0

this answer was rushed. Line 3 throws an error as well.

0

Fail

0

Son i said im not good at scripting is having a go a crime or sum? why yall bein hella rude

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