Hello I need help with duplicating a tool twice into my backpack.
This is my script and I need help duplicating twice.
1 Like
Try calling :Clone()
from within your MouseClick
event function as opposed to assigning it as a variable. Since you have it as a variable, the same object will be used each time some one clicks on the ClickDetector, no new objects will be created after the variable assignment.
Basically just move your cl
variable declaration in the scope of your MouseClick
function.
create another variable which is gonna be like ur normal script but add this:
local One = script.Parent.Parent.One
local Two = script.Parent.Parent.Two
local cl = game.ReplicatedStorage.Wheat:clone()
local cl2 = game.ReplicatedStorage.Wheat:clone()
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
local Par = plr.Name
One.Decal1.Transparency = 1
One.Decal2.Transparency = 1
Two.Decal1.Transparency = 1
Two.Decal2.Transparency = 1
script.Parent.ClickDetector.MaxAcitvationDistance = 0
cl.Parent = game.Players:FindFirstChild(Par).Backpack
cl2.Parent = game.Players:FindFirstChild(Par).Backpack
script.Parent.Plant.Disabled = false
script.Disabled = true
end)
The script posted above basically adds a second variable which is “cl2”:
local cl2 = game.Replicated.Storage.Wheat:clone()
And just inserts it again into ur inventory.
cl2.Parent = game.Players:FindFirstChild(Par).Backpack