This is yet another attempt at my pickUp Script like I said before. I'm slowly making it more universal, I've gotten to a decent point where most of it is. The problem I'm having is the item identifier loop, it's a bit hard to explain, so here's the Script, it'll be a lot easier to understand where I'm getting at if you have at least intermediate knowledge
function findObject(instance,object,handle) local itemDecendants = instance:GetDescendants() for _,object in ipairs(itemDecendants) do if (object:IsA(object) and object.Parent:IsA(instance.ClassName) and object:IsDescendantOf(instance)) and object.Name == handle then print(object:GetFullName().." "..instance); return object end end end local localPlayer = game:GetService("Players").LocalPlayer local cursor = localPlayer:GetMouse(); local cursorPoint = cursor.Target local item_ while (cursorPoint ~= item_) do if (cursorPoint:IsA("BasePart")) then --//Set to 'Tool'. for _, descendant in ipairs(cursorPoint:GetDescendants()) do if type(descendant) == 'boolean' and findObject(descendant, "BoolValue", "ItemTag") then item_ = cursorPoint end end end wait(.5) end local item = workspace:FindFirstChild(item_) print(item.Name.."-"..item:GetFullName())
I'm getting nothing out in the output, and it seems like the while loop isn't running at all, this is my first grasp at a universal loop, so don't judge, please fill me in on efficiency tips or other issues.
The Cursor also freezes when I click anywhere in workspace, what's wrong?!
if this is still confusing ask me to re-explain it and I'll try my best
thanks!