Script support needed

Hello, I am trying to make a system where you click a button you get a tool. I have already made it so you get a tool but don’t know how to do so players can’t spam the button and get multiple tools, can anybody help? I have been searching alot but have been unable to find anything. I have only been scripting for 5 days.

local Tool = game.ServerStorage.Tool

script.Parent.MouseClick:Connect(function(player)
	local CloneTool = Tool:Clone()
	CloneTool.Parent = player.Backpack
	CloneTool.Name = "Pickaxe"
end)
1 Like

If a tool is equipped, it gets moved to the character. Otherwise, it will be moved to the player’s Backpack.

Doesn’t matter if the pickaxe is equipped or not, it will still check both the character and backpack for a pickaxe. If found, it won’t do the cloning.

local Tool = game.ServerStorage.Tool

script.Parent.MouseClick:Connect(function(player)
	if player.Backpack:FindFirstChild("Pickaxe") or player.Character:FindFirstChild("Pickaxe") then
		return
	end
	
	local CloneTool = Tool:Clone()
	CloneTool.Parent = player.Backpack
	CloneTool.Name = "Pickaxe"
end)
1 Like