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.
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)
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)
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)
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.