EDIT: I found out that the ClickDetector doesn't work
So I was scripting for someone, it went fine. But then I had to make this script, I see no error, there is not an error in the output either, I've rewritten the script several times, but it doesn't seem to work
Script:
local debounce = false
for _, model in pairs(script.Parent:GetChildren()) do
if model:IsA("Model") then
for _, part in pairs(model:GetChildren()) do
if part:FindFirstChild("ClickDetector") then
local storage = game:GetService("ServerStorage")
part.ClickDetector.MouseClick:connect(function(player)
if debounce == false and storage:FindFirstChild(part.Name) then
debounce = true
local clone = storage:FindFirstChild(part.Name):Clone()
clone.Parent = player.Backpack
wait()
debounce = false
end
end)
end
end
end
end
Layouts:
Note: not all items are shown in the item layout

2 comments
Which line has the error?
As I said, there is no error