Click to get tool

Uhh so what do I go with lol??

I suggest you to try mine, it should work for other players, and only if the player has the tool.

Also, theres pretty much no point adding a debounce to this script.

I did not add a debounce. Where do you see a debounce?

Seems like you don’t need this part then.

1 Like

There is a blue line under debounce, line 10.

Sorry, my bad, delete it. 30 charssss

Correct, sorry. Didn’t notice when I copied it.

1 Like

Delete what?
30 charrrsssssssss

the

and debounce == false

The if should be without the debounce, I accidentally added it.
.There it is:

local ToolNames = {"Sleeping Set"}
local Storage = game:GetService("ServerStorage")



local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")

ClickDetector.MouseClick:Connect(function(Player)
	if Player and Player.Character then
		local Backpack = Player:WaitForChild("Backpack")
		for i = 1, #ToolNames do
			if(not Player.Character:FindFirstChild(ToolNames[i]) and not Backpack:FindFirstChild(ToolNames[i])) then
				local Tool = Storage:FindFirstChild(ToolNames[i])
				if Tool then
					Tool:clone().Parent = Backpack
				end
			end
		end
	end
end)
1 Like

Does not work.

30 charrsssssssssss

When cloning tools locally, the server scripts inside the tool will not notice the change and won’t work.
The server is also unable to see this change, when you check their backpack on the server, they won’t show up.

That is also a good reason to never do this on the client.

1 Like

Output please? 30charrssssssssssssssssssss

That’s correct but that quote is only him telling me to remove the debounce part I forgot to remove.

There is nothing in the output relating to the thing.

1 Like

Just a second, I am trying the script.
I made one myself, that works for me, try this:

local ToolNames = {"ClassicSword"}
local Storage = game:GetService("ServerStorage")



local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")

ClickDetector.MouseClick:Connect(function(Player)
	if Player and Player.Character then
		local Backpack = Player:WaitForChild("Backpack")
		for index, place in ipairs(ToolNames) do
			if(not Backpack:FindFirstChild(place)) then
				local Tool = Storage:FindFirstChild(place)
				if Tool then
					Tool:Clone().Parent = Backpack
				end
			end
		end
	end
end)

Change the sword to your tool. I just tested. And also works with multiple tools. I tried it. And the same with more than 1 player. And @Xueify was correct, we chatted in DMs, there’s no need for the character check that I added because you can’t hold a tool and click a click detector.

If the script I posted did not work for you,
there is certainly something wrong on your side.

1 Like

No, in general there is no need for it unless he wanted one himself, hence why I stated Based on your script, here’s a new version that is fully functional. at the beginning.

1 Like

It worked! Thank you so much!!

1 Like

Great! Then please mark my answer as a solution. :slight_smile: :+1: