I have a script that should add smooth limb collision detection but the main problem(s) is it firing while mid-air (print function prints {}, but no table contents), and after a few seconds, errors with the error message “Part parameter must be BasePart”. I am confused because “Head” is a BasePart, and I assume a table with no contents should return nil.
Here is my code:
local RS = game:GetService("RunService")
RS.Heartbeat:Connect(function()
local OverlapParamss = OverlapParams.new()
OverlapParamss.FilterType = Enum.RaycastFilterType.Blacklist
OverlapParamss.FilterDescendantsInstances = script.Parent:GetDescendants()
local Head = script.Parent:WaitForChild("Head", 3)
local Torso = script.Parent:WaitForChild("Torso", 3)
local LArm = script.Parent:WaitForChild("Left Arm", 3)
local RArm = script.Parent:WaitForChild("Right Arm", 3)
local LLeg = script.Parent:WaitForChild("Left Leg", 3)
local RLeg = script.Parent:WaitForChild("Right Leg", 3)
local HParts = workspace:GetPartsInPart(Head, OverlapParamss)
--local TParts = workspace:GetPartsInPart(Torso, OverlapParamss)
--local LAParts = LArm:GetPartsInPart()
--local RAParts = RArm:GetPartsInPart()
--local LLParts = LLeg:GetPartsInPart()
--local RLParts = RLeg:GetPartsInPart()
if HParts ~= nil and Head.Velocity.Magnitude > 75 then
script.Parent.Humanoid:TakeDamage(1)
print(HParts)
end
end)
Thank you for any help anyone has!