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

How to clone a separately different item on a giver?

So, I have this script that makes it so that if I click an object it gives me an item. Problem is when I tested it out with 2 people when one person clicks it while the other person has the item, it just gives the person the item from the other person meaning the item can only be given to a user one at a time. I want to make it so that it can have infinite amount of the item. Heres the script.

local tool = game.ServerStorage.Pizza local klone = tool:clone() script.Parent.ClickDetector.MouseClick:Connect (function(plr) if klone.Parent ~= plr.Backpack then klone.Parent = plr.Backpack else end end)

1 answer

HI! The reason your give is not cloning is because you clone the object only once. You should make a new clone each time the giver is used.

local tool = game.ServerStorage.Pizza
script.Parent.ClickDetector.MouseClick:Connect (function(plr klone = tool:clone() ) if klone.Parent ~= plr.Backpack then klone.Parent = plr.Backpack else end end)

Haven't tested the code, may not work, but you get the idea.

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