"Part parameter must be BasePart"

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")

	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

Thank you for any help anyone has!

Where’s your script located?
Is the Head actually located at script.Parent:WaitForChild(“Head”, 3)`?

1 Like

The script is located in StarterCharacterScripts.

Ok, but please answer both questions…

1 Like

Oh, sorry, I didn’t see the second one. Yes, it is, and StarterCharacterScripts automatically parents the script to any new character that is loaded in the game. Also, the “Part parameter must be BasePart” error happens in StarterCharacterScripts, and not in the character, so I’m only focusing on the event firing while mid-air when the whole character’s descendants is blacklisted.

Add this to the very top of your script:

if script:FindFirstAncestor("StarterPlayer") ~= nil then

And I do mean at the very top…before local RS = game:..... Myself, and others, have ran into the problem because scripts execute both out of Player and StarterPlayer. So that code checks to see if it’s running from StarterPlayer. If it is then exit the script.

Let me know if that fixes the error.

1 Like

Thank you so much! I will also be opening another thread asking on how to solve an issue with the event firing while mid-air, but once again, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.