I've recently made a cup clicker, so if you click a cup, it'll give you one, the only issue here is that if you try to get multiple cups by clicking multiple times, it won't.
If you're wondering about the script, here it is:
local tool = game.ServerStorage.Cup local klone = tool:clone() script.Parent.ClickDetector.MouseClick:connect (function(plr) if klone.Parent ~= plr.Backpack then klone.Parent = plr.Backpack else end end)
local tool = game.ServerStorage.Cup local klone = tool:clone() script.Parent.ClickDetector.MouseClick:connect (function(plr) --if klone.Parent ~= plr.Backpack then klone.Parent = plr.Backpack --Says tool will clone to backpack if it doesnt already exist. So change the not sign to an equal sign so to change it. You dont need an if statement. klone.Parent = plr.Backpack end end)
What you did wrong is you defined the "klone" variable before the function runs. This means that there is only 1 instance that the script is allowed to give to the player. To fix this, simply move the tool variable inside of your function. The fixed script would look like this:
local tool = game.ServerStorage:WaitForChild("Cup") script.Parent.ClickDetector.MouseClick:connect (function(plr) local klone = tool:clone() -- makes a new clone every click so you have more than one. if klone.Parent ~= plr.Backpack then klone.Parent = plr.Backpack else end end)
Hope I helped!