Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CollectionService = game:GetService("CollectionService")
- local Checker = {}
- Checker.GrabbedObjects = {}
- function Checker.Check(Object: Instance)
- local Grabbable = true
- if Object:IsA("BasePart") and not (Object.Parent:FindFirstChildOfClass("Humanoid") or Object.Anchored) then
- if not CollectionService:HasTag(Object, "Grabbable") then
- Grabbable = false
- end
- if Grabbable then
- for _, GrabbedObject: BasePart in Checker.GrabbedObjects do
- if GrabbedObject == Object then
- Grabbable = false
- break
- end
- end
- end
- if Grabbable then
- for _, ConnectedObj: Instance in Object:GetConnectedParts(true) do
- if ConnectedObj.Anchored then
- Grabbable = false
- break
- end
- end
- end
- else
- Grabbable = false
- end
- Checker.Grabbable = Grabbable
- end
- return Checker
Add Comment
Please, Sign In to add comment