Still have questions? Join our Discord server and get real time help.
0

# Script only giving tool once and I want to to give it an infinite amount of times?

I'm making a dinner, I have food on plates around on random tables and want you to be able to click on the food and get it given to you. This is the script I have

local tool = game.ServerStorage.Burger -- Burger is the food item I want given
local clone = tool:clone()
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if clone.Parent ~= plr.Backpack then
clone.Parent = plr.Backpack
else
end
end)


It only gives the tool once and then wont give it again, I want players to be able to take it an unlimited amount.

0

first of all you gotta put the clone in the function:

local tool = game.ServerStorage.Burger -- Burger is the food item I want given

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
local clone = tool:clone()
clone.Parent = plr.Backpack -- you can skip the check btw
end)


else it would create only one clone for the entire runtime, thus only one burger.

0
Thank you, it works perfectly jacksworld2808 15 — 6mo
0
it should be tool:Clone() instead of tool:clone() AnasBahauddin1978 478 — 6mo