GetTouchingParts not detecting a Player

Hello. I’m trying to make a healing spell in my game, that once you cast said spell, an area will be created where the mouse is and start healing Players that are on top of it. The part of creating the area is already done and working, the part that i’m having problem is the heal part, more specific, the area not detecting if there’s a Player on top of it.

Here’s the healing script:

for x = 1,5,1 do
	task.wait(1)
	local PlayersToHeal = HealZone:GetTouchingParts()
	print(PlayersToHeal)
	local PlayerHealed = {}
	for y = 1,#PlayersToHeal,1 do
		if PlayersToHeal[y].Parent:FindFirstChild("HumanoidRootPart") and not PlayersToHeal[y].Parent:FindFirstChild("HitBox") and not table.find(PlayerHealed, PlayersToHeal[y].Parent.Name) then
			table.insert(PlayerHealed, PlayersToHeal[y].Parent.Name)
			local PlayerHealing = game.Players:GetPlayerFromCharacter(PlayersToHeal[y].Parent)
			local Health = PlayerHealing.Stats.Health
			if Player.Element.Value == "Grass" then
				Health.Value += (PlayerHealing.Level.Value/3)
			else
				Health.Value += (PlayerHealing.Level.Value/4)
			end
		end
	end
end

There’s more to that code, but it’s not important. Well, when i run the game and step on top of this zone, it just don’t detect nothing.

Idk if the CanCollide should be active or not, either way this isn’t working, but when it’s active, it can detect the baseplate.

1 Like

Hey, try switching the GetTouchingParts to workspace:GetPartsInPart() and see if that works, you’ll need to create OverlapParams for it though, but it should be easy enough. Let me know if you need any help with that.
The issue with :GetTouchingParts is that it needs the part’s collision to be set to true, there’s a workaround for that, but it’s easier to jsut use workspace:GetPartsInPart

1 Like

It worked very well! I didn’t even had to create OverlaParams. Thank you very much!

2 Likes

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