Click to get tool

Why do you think so? It absolutely can. I made things like this in the past, worked like a charm. The tools in the backpack do replicate to the server. I suggest you test it. I made things like that a lot in the past. And it’s not in the ServerScriptService, it’s in the part.

Hold on I will test too.
See this?


In the server.

I’m sure you can’t clone the tool from the ServerStorage to the player’s backpack using a script. I think I am missing something.

I am going to test it.

Look at this, works like a charm.
robloxapp-20200616-1951449.wmv (739.8 KB)
Test script:

local tool = game.ServerStorage.ClassicSword
script.Parent.ClickDetector.MouseClick:Connect(function(player)
	if(not player.Backpack:FindFirstChild(tool.Name) and not player.Character:FindFirstChild(tool.Name)) then
		tool:Clone().Parent = player.Backpack
	end
end)

Multiple players test:
robloxapp-20200616-1953038.wmv (591.3 KB) robloxapp-20200616-1953130.wmv (755.4 KB)

Based on your script, here’s a new version that is fully functional.

local Tools = {
	'Tool',
	'Tool2'
}

local ServerStorage = game:GetService('ServerStorage')

local Part = script.Parent
local ClickDetector = Part.ClickDetector

local Debounces = {}
local Cooldown = 3

ClickDetector.MouseClick:Connect(function(Player) -- :connect() is deprecated, use :Connect().
	if Debounces[Player.Name] then -- Set the debounce for the player instead of everyone (?)
		return
	end
	
	local Character, Backpack = Player.Character, Player:FindFirstChild('Backpack')
	if Character and Backpack then
		for _,v in ipairs(Tools) do 
			-- ipairs is used for arrays, while pairs is used for dictionaries.
			 
			local FindTool = Backpack:FindFirstChild(v)
			if not FindTool then
				ServerStorage[v]:Clone().Parent = Backpack
				Debounces[Player.Name] = true
				wait(Cooldown)
				Debounces[Player.Name] = nil
			end
		end
	end
end)

Yeah it makes sense that it can do it server sided too due to exploiters, thanks! :+1:

1 Like

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