Hello again:3, I am still confused with this Universal grasping loop, I think I've got it, but I have another issue. It's grasping the wrong Object, even though there are strict requirements in place, I believe it is a syntaxing error that I've made, but I can't seem to wrap my head around it as I have too many other issues I'm focusing on, also, I suck at making Universal Scripts, I'm all direct or dynamic.
As I've explained before, this loops job is to find out whether or not your cursor is overtopping an item
, this item must have an ItemTag
; boolean - in order to be counted as an item
, It keeps thinking the character's leg or sky is an `item' or maybe it's something I've done wrong, most likely the second option;), here's the script
local localPlayer = game:GetService("Players").LocalPlayer local cursor = localPlayer:GetMouse(); local cursorPoint = cursor.Target local item_ while (cursorPoint ~= item_) do print("Ran") cursorPoint = cursor.Target pcall(function() if cursorPoint:IsA("BasePart") then --//Set to 'Tool'. print(cursorPoint) for _, descendant in ipairs(cursorPoint:GetDescendants()) do if findObject(descendant, "BoolValue", "ItemTag") then print("foundItem") item_ = cursorPoint.Name cursorPoint = item_ end end end end) wait(.5) end print("Item Checked.") --// Just to let me know if the loop actually broke, in this case, did.
A variable is supposed to index the item, but since it's not actually an Item, it keeps giving me
Argument 1 missing or nil
local item = workspace:WaitForChild(item_)
Could someone help me fix this, also potentially find a patch to make sure it doesn't break for touching the sky or character or chatGui? - also happens.
Thanks!