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

Clone Frame By TextButton Click?

Asked by 5 years ago

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

Log in to vote
2
Answered by 5 years ago
Edited 5 years ago

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)

0
Approved! User#21499 0 — 5y
Ad
Log in to vote
-3
Answered by 5 years ago
Edited 5 years ago

Try this!

Local Costume1  = game.ReplicatedStorage.Costume1
script.Parent.MouseButton1Click:Connect(function()
local clone = Costume1:Clone
clone.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
end)
0
Not that good at scripting but I tried. Lol WillBe_Stoped 71 — 5y
0
first line will make an error, lua is case sensitive. mixgingengerina10 223 — 5y
0
you realize when you downvote, you are basically losing reputation too...? greatneil80 2647 — 5y
0
this answer was rushed. Line 3 throws an error as well. User#19524 175 — 5y
View all comments (2 more)
0
Fail AswormeDorijan111 531 — 5y
0
Son i said im not good at scripting is having a go a crime or sum? why yall bein hella rude WillBe_Stoped 71 — 5y

Answer this question