I have mostly completed my pickUp Script, I just have one more issue. The Search loop functions as intended; when I find the item, I also set the clickDetector that was located inside the BasePart. It seems to have been found, except the MouseClick event doesn't fire, I'm not sure if it didn't find it or not, yet as I said it seems like it had.
if I also try to set the clickDetector to nil, as shown in the code, it seems to lock my mouse if I right-click. This only happens if I set that line.
spawn(function()
while wait(.5) do
while (checkForItem) do
cursorPoint = cursor.Target
pcall(function()
print(cursorPoint)
if cursorPoint:IsA("BasePart") then --//Set to 'Tool'.
print("BasePart - '"..cursorPoint.Name.."'")
for _, descendant in ipairs(cursorPoint:GetDescendants()) do
if findObject(descendant, "BoolValue", "ItemTag") then print("foundItem")
item_ = cursorPoint.Name
item = workspace:WaitForChild(item_)
clickDetector = findObject(item, "ClickDetector", "ClickDetector")
checkForItem = false
end
end
end
end)
wait(.5)
end
cursorPoint = cursor.Target
if item then
if (cursorPoint ~= item and checkForItem ~= true) then
clickDetector = nil --//:/
checkForItem = true
item_ = nil
item = nil
end
end
end
end)
The findObject(instance, object, handle) function - if index instance passes through everything - will print the full name of the object
This is the output:
Rifle BasePart - 'Rifle' Workspace.Rifle.ClickDetector.SlotSize.ItemTag foundItem Workspace.Rifle.ClickDetector
This is the click statement, narrowed down
if clickDetector then print("Cool")
clickDetector.MouseClick:Connect(function(player)
print("Clicked")
end)
end
This also caused my mouse to freeze. It also doesn't print......
Please help me, it's very annoying

3 comments
make sure its a serverscript
?
Could you explain? I’ve never really worked with clickDetectors so if this ends up requiring FE or rewriting, I have a lot of rearranging to do and that’ll not be fun:/