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

Why won't this LocalScript clone when I touch a part?

I have a part in the workspace that you must touch to clone a local script in the "Backpack", but it won't work

local function Touched()
game.Players.LocalPlayer.Backpack.LocalScript:Clone()
end
script.Parent.Touched:connect(Touched)

Anyone know a solution?

2 comments

0

Lol. You didn't complete the () on line 4. Also, you didn't state the local scripts PARENT

0

is this script currently a localscript?

2 answers

You had the right idea, just forgot a few steps.

local function Touched()
	local clone = game.Players.LocalPlayer.Backpack.LocalScript:Clone()
	clone.Parent = ReplicatedStorage --//Change ReplicatedStorage with wherever you want to keep the clone.
end
script.Parent.Touched:connect(Touched()

You forgot a few end brackets

local function Touched()
local clone = game.Players.LocalPlayer.Backpack.LocalScript:Clone()
clone.Parent = game:GetService("Wherever you want it to go...")
end
script.Parent.Touched:Connect(Touched)

2 comments

0

You didn't state the parent

0

yeah... forgot lol. STATE THE PARENT TOOo!!!

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