What method should I use for players to heal over-time if they’re in an area?
Touched, Region3, Magnitude or GetTouchingParts?
I would like if the player is on or touching a part, the start being healed overtime, but how should I make the ‘overtime’ happen, I’d need to detect if the player is constantly touching the part but .touched may only trigger once, so what method do i use?
It’s not found because table.find locates ‘needles’ in a ‘haystack.’
Here’s how it works, from the document site:
local t = {"a", "b", "c", "d", "e"}
print(table.find(t, "d")) --> 4
print(table.find(t, "z")) --> nil, because z is not in the table
print(table.find(t, "b", 3)) --> nil, because b appears before index 3
To see if Humanoid is inside, you’d have to loop through all the values and see if it matches the HumanoidRootPart of their character.
I would recommend GetPartsInPart or a similar method. To counteract the issue of multiple character parts being detected, you can have a whitelist of all the HumanoidRootParts.
Make sure that when the character respawns, you add the new HumanoidRootPart to the whitelist and remove the old one.
You can now periodically check for characters in the zone, and add on to their health that way.