How Do I Clone A Tool After It Is Taken?

Hello, developers. I started making a cup system. In a nutshell, when you click on it, it takes a cup from lighting and puts it in the player’s backpack.

However, this can only be done once because the cup has been removed from the lighting. Can any help me figure out how to clone it again after the cup was taken so that others can use it?

Thanks!

Here’s my code.

local cup = game.Lighting.Cup

game.Players.PlayerAdded:Connect(function(player)
	script.Parent.MouseClick:Connect(function()
		cup:Clone()
		cup.Parent = player.Backpack
	end)
end)

You would just a create a new variable.

local cup = game.Lighting.Cup

game.Players.PlayerAdded:Connect(function(player)
	script.Parent.MouseClick:Connect(function()
		local newCup =  cup:Clone()
		newCup.Parent = player.Backpack
	end)
end)
1 Like