Better encounter system

I’m trying to achieve a better encounter system
in the next video the 1 printed when the touched event happend


in this video you can see that when forward and backwards, it doesn’t reacts the touched event, but when i jump it does.
that’s the script I’m using:

	local function OnEncounter(hit)
		if Players:FindFirstChild(hit.Parent.Name) then
			print(1) -- the 1 in the console
			local Player = Players:FindFirstChild(hit.Parent.Name)
			if not Player:FindFirstChild("Debounce") then
				local Debounce = Instance.new("BoolValue")
				local point = math.random(1, encounterRate)
				Debounce.Name = "Debounce"
				Debounce.Parent = Player
				if point == 1 then
                -- enter battle
				end
				wait(2)
				Debounce:Destroy()
			end
		end
	end
	
	field.Touched:Connect(OnEncounter)

but it just works really weird, anyone knows how can I improve it?

Instead of having it on the ground you can make an invisible part that the player goes through which can make the touched event react better.

I suggest you use this instead

that still does the same thing.

Why not change up your detection system, you can try using regions or raycasting.

So if I’ll use regions, there are more than 1 fields, so i’ll have to go over all the fields and do something like this:

for _, field in pairs(fields) do
    spawn(function()
        -- make region with field part and then
        while wait() do
             parts = workspace:FindPartsInRegion3(region)
             for i, part in pairs(parts) do
                 onEncounter(part)
             end
        end
     )
end

like that?
with raycasting, i have no idea what to do with it lol.
and also wouldn’t regions be inefficient?

wait what, somehow by making the part smaller, it works better now, and it’s the the same script.

okay so one question, the touched event is happening a lot, will that somehow affect my game performance?