• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


29 Nov, 2024

Updated at 02 Dec, 2024

:GetPartsInPart() Doesn't Work!

Hello people and developers! :wave:
(There are probably a lot of solutions, but I actually read and couldn’t find anything wrong with my code)
I have a custom hitbox, and when using :GetPartsInPart(), it does not work at all. Nothing gets returned. Here is the sniplet which you need most likely:

ExecutionRemote:FireClient(Player)
		local OP = OverlapParams.new()
		OP.FilterType = Enum.RaycastFilterType.Exclude
		OP.FilterDescendantsInstances = {Character}
		local Hits = workspace:GetPartsInPart(LaunchHitBox, OP)
		
		local Potential = {}
		print(Hits, "Hits")
		for i, v in pairs(Hits) do
			local PCharacter = v.Parent
			if PCharacter:IsA("Model") then
				local PHumanoid = PCharacter:FindFirstChild("Humanoid")
				if PHumanoid and PHumanoid:IsA("Humanoid") then
					print(PCharacter)
					if Potential[PCharacter] == nil then
						Potential[PCharacter] = PCharacter
					end
				end
			end
		end

This is how it gets called:

--Mover and Launch
	local MoveThread = coroutine.create(function()
		task.wait(RS_Settings.Server.LaunchDuration)
		StopLaunch()
		coroutine.yield()
	end)
	coroutine.resume(MoveThread)

	--Touched and Stop Thread
	local TConnection = nil
	TConnection = LaunchHitBox.Touched:Connect(function(Part)
		local PCharacter = Part.Parent
		if PCharacter:IsA("Model") then
			local PHumanoid = PCharacter:FindFirstChild("Humanoid")
			if PHumanoid and PHumanoid:IsA("Humanoid") then
				TConnection:Disconnect()		
				coroutine.close(MoveThread)
				StopLaunch()
			end
		end
	end)

Now here are the print statements:
image
Clearly its not returning anything. If I remove the OverlapParams, it returns my own character :skull:
Here is ingame picture btw: ITS CLEARLY HITTING
image
Thanks for stopping by! :slight_smile:

3 posts - 2 participants

Read full topic