How can i check with region3d if the player is no longer on the part

I already made a script but sometimes the part stuff freezes and idk why

   script.Parent.Pad1.Pad1.TouchEnded:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if Player1.Value ~= nil then
		local s = true
		
		local partsinregion = game.Workspace:FindPartsInRegion3WithWhiteList(region, {plr.Character["HumanoidRootPart"]}, 100)
		 
		
		for i,v in pairs(partsinregion) do



			s = false



		end


		if s == true then
			script.Parent.Pad1.Pad1.Color = Color3.fromRGB(163, 162, 165)
			script.Parent.Pad1.Pad1.Material = "Plastic"
			Player1.Value = nil



		else
			s = true
		end
		
	end
end)

Region3 is deprecated, GetPartsInParts is the replacement.

Just a suggestion but what i always do to check if a player is in a region i just do a raycast from the HumanoidRootPart and whitelist the part that acts as the region. If there is a result then the character is inside the region.

The docs have a good example that fits this scenario, i’ll link it below:
https://developer.roblox.com/en-us/api-reference/function/WorldRoot/Raycast