GetConnectedParts(true) is not returning the parts connected via hingeconstraints. This makes it really hard

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I have a race game and the cars there have a collision system. When a part gets damaged it’s supposed to check if it’s connected to a chassis and if it isn’t then it gets parented to workspace.

  2. What is the issue? The issue is that the steering wheel which is only connected via a constraint and not a rigid joint does not get considered and so it gets parented to workspace which breaks the car.

  3. What solutions have you tried so far? I tried looking in developer hub and foudn that BasePart | Documentation - Roblox Creator Hub is only for the near parts and there isn’t anywhere that says .getConnectedParts(true) that iterates. So I really don’t know what to do.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

The script below checks for any loose pieces… apparently the things attached via hingeconstraints are also loose…

local function CarCheck(Car)
	
	for i,v in pairs(Car:GetDescendants()) do
		if v:IsA("BasePart") then
			if v.Name == "Chassis" then
				local chassisconnections =  v:GetConnectedParts(true)
				for i,weldedparts in pairs(chassisconnections) do
					if chassisconnections == nil or #chassisconnections == 1 then
						v.Parent.VehicleSeat.Health.Value = 0
						print("vehicle seat has been disabled")
					else
					local carparts = Car:GetDescendants() do
						
						for i,pieces in pairs(carparts) do
						if pieces:IsA("BasePart") then
						local obj = chassisconnections[table.find(chassisconnections,pieces)]
							if obj then 
							--	print("object secured")
							else
							--	print("Object loose...")
								
								if string.match("engine",string.lower(v.Name)) then
									for i,v in pairs(v:GetDescendants()) do
										if v:IsA("Sound") then
											coroutine.wrap(function()
												while v.Volume > 0 do
													wait(0.2)
													v.Volume = v.Volume - 0.01
													v.PlaybackSpeed = v.PlaybackSpeed - 0.1
												end		
											end)()	
										end
									end
								end
								
								pieces.Parent = game.Workspace	
								
							end
						end
						end
						end	
					end
					-- find the parts that are not connected to the chassis and delete them
				end
			end	
		end
	end

end
1 Like

Please help? I still haven’t found a solution to this issue

I think youd want to use basepart:GetJoints() I seriously doubt youre still having this issue 2 years later but…

hi

I’m not having this issue anymore. My scripting skills are increased