workspace:GetPartsInPart not working


So I’m trying to use workspace:GetPartsInPart to determine when a note on a rhythm game should be hit.

Now, my problem is simple:
Nothing works.

I cannot find any working way to detect note hits using multiple methods, such as GetPartsInPart and GetPartsInBox.

Before you ask, No I cannot use magnitude as the notes are square and not circle.

My code:

function ProcessNote(Note, Key)
	if Note.Position.Z > -1 and not table.find(HitNotesTable, Note) and table.find(workspace:GetPartsInPart(Note), Cursor) then
		table.insert(HitNotesTable, Note)
		HitNotes += 1
		Combo += 1
		TotalNotes += 1
		task.spawn(function() HitNote(Note.Position, Note.Color) end)
		if Key ~= nil then RunService:UnbindFromRenderStep(Key) end

The entire game is done through the client, too.

You can’t use workspace:GetPartsInPart() because workspace isn’t a part. What is your objective when using workspace:GetPartsInPart()? I can find another solution for you.

That’s… what? that’s an API function that returns a table consists of parts inside a part itself??

You probably forgot to include OverlapsParams.

Printing the GetPartsInPart returns a table of everything except the cursor, which is a part and is in the note.

However, after troubleshooting more, I actually found the solution.

The problem wasnt the ProcessNote function, but instead the CursorPosition function.
The cursor was 1 stud ahead of where it was supposed to be, and wouldn’t hit the notes because they actually never touched the cursor.

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